﻿

'*******************************************************************
' Program: Data Center Visio Rack Tool
' Author: Albert E Edlund
' Date:
'
' Purpose:
'
'
' this class library has to remain in the object project so that we do not create
' a circular call from reporting and systems management
'
' Obtain an OID (Object IDentifier) from IANA. To participate in the SNMP arena, you need to 
' define your classes and events in a MIB file. First, The SNMP root node must be a unique number 
' (only ONE MIB/SNMP Private Enterprise number is permitted per organization). IANA: 
' http://www.iana.org/cgi-bin/enterprise.pl 
' 
' Create a MIB (Management Information Base) file (check out Appendix B for some useful and easy-to-use 
' MIB editors). Define classes and SNMP traps (events) that eventually will be exposed by the WMI Provider. 
' c:\windows\system32\wbem (after wmi/snmp support is installed)
' Compile the MIB file using the SMI2SMIR utility. This will generate a MOF file. 
' now put it into the wmi repository
' for the rfc1213 mib the file call format was first the file and then the list of embedded dependencies
'
' c:\windows\system32\wbem\mof
'
' Compile the MOF file using the mofcomp.exe compiler to check the MOF file syntax correctness. 
' 
' Create the vb classes and events with the Mgmtclassgen utility (refer to Appendix B). 
' Use the C# classes to create WMI provider. 
'
' c:\program files\microsoft sdks\windows\v6.1\bin\mgmtclassgen
'
' mgmtclassgen Win32_LogicalDisk /n root\cimv2 /l VB /p c:\disk.vb
' mgmtclassgen Win32_ComputerSystem /n root\cimv2 /l VB /p c:\computer.vb
' mgmtclassgen Win32_OperatingSystem /n root\cimv2 /l VB /p c:\OperatingSystem.vb
' mgmtclassgen Win32_Processor /n root\cimv2 /l VB /p c:\Processor.vb
' mgmtclassgen Win32_DiskPartition /n root\cimv2 /l VB /p c:\Partition.vb
' mgmtclassgen Win32_NetworkAdapter /n root\cimv2 /l VB /p c:\NetAdapt.vb
' mgmtclassgen Win32_NetworkAdapterConfiguration /n root\cimv2 /l VB /p c:\NetConfig.vb
' mgmtclassgen Win32_NTLogEvent /n root\cimv2 /l VB /p c:\NtLog.vb
'
'
' SNMP_RFC1213_MIB_icmp
' SNMP_RFC1213_MIB_ifTable
' SNMP_RFC1213_MIB_ipAddrTable
' SNMP_RFC1213_MIB_ipRouteTable
' SNMP_RFC1213_MIB_System

' mgmtclassgen SNMP_RFC1213_MIB_ipaddrtable /n root\snmp\smir /l VB /p c:\rfc1213.vb
'
'*******************************************************************

Imports System
Imports System.ComponentModel
Imports System.Management
Imports System.Management.Instrumentation
Imports System.Collections
Imports System.Globalization
Imports Microsoft.VisualBasic

Imports Microsoft.Practices.EnterpriseLibrary.Common
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling





Public Class SnmpResults


#Region "SNMP_RFC_1213"

    'Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
    'Functions Is<PropertyName>Null() are used to check if a property is NULL.
    'Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
    'Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
    'An Early Bound class generated for the WMI class.snmp_rfc1213_mib_system
    Public Class Rfc1213_mib_system
        Inherits System.ComponentModel.Component



#Region "create"

        'Private property to hold the WMI namespace in which the class resides.
        Private Shared CreatedWmiNamespace As String = "root\snmp\smir"

        'Private property to hold the name of WMI class which created this class.
        Private Shared CreatedClassName As String = "snmp_rfc1213_mib_system"

        'Private member variable to hold the ManagementScope which is used by the various methods.
        Private Shared statMgmtScope As System.Management.ManagementScope = Nothing

        Private PrivateSystemProperties As ManagementSystemProperties

        'Underlying lateBound WMI object.
        Private PrivateLateBoundObject As System.Management.ManagementObject

        'Member variable to store the 'automatic commit' behavior for the class.
        Private AutoCommitProp As Boolean

        'Private variable to hold the embedded property representing the instance.
        Private embeddedObj As System.Management.ManagementBaseObject

        'The current WMI object used
        Private curObj As System.Management.ManagementBaseObject

        'Flag to indicate if the instance is an embedded object.
        Private isEmbedded As Boolean

        'Below are different overloads of constructors to initialize an instance of the class with a WMI object.
        Public Sub New()
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_system.ConstructPath), Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope)
            MyBase.New()
            Me.InitializeObject(mgmtScope, New System.Management.ManagementPath(Rfc1213_mib_system.ConstructPath), Nothing)
        End Sub

        Public Sub New(ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_system.ConstructPath), getOptions)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, New System.Management.ManagementPath(Rfc1213_mib_system.ConstructPath), getOptions)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(Nothing, path, Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, getOptions)
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                PrivateLateBoundObject = theObject
                PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
                curObj = PrivateLateBoundObject
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementBaseObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                embeddedObj = theObject
                PrivateSystemProperties = New ManagementSystemProperties(theObject)
                curObj = embeddedObj
                isEmbedded = True
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        'Property returns the namespace of the WMI class.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property OriginatingNamespace() As String
            Get
                Return "root\snmp\smir"
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property ManagementClassName() As String
            Get
                Dim strRet As String = CreatedClassName
                If (Not (curObj) Is Nothing) Then
                    If (Not (curObj.ClassPath) Is Nothing) Then
                        strRet = CType(curObj("__CLASS"), String)
                        If ((strRet Is Nothing) _
                                    OrElse (strRet Is String.Empty)) Then
                            strRet = CreatedClassName
                        End If
                    End If
                End If
                Return strRet
            End Get
        End Property

        'Property pointing to an embedded object to get System properties of the WMI object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property SystemProperties() As ManagementSystemProperties
            Get
                Return PrivateSystemProperties
            End Get
        End Property

        'Property returning the underlying lateBound object.
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property LateBoundObject() As System.Management.ManagementBaseObject
            Get
                Return curObj
            End Get
        End Property

        'ManagementScope of the object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property Scope() As System.Management.ManagementScope
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Scope
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                If (isEmbedded = False) Then
                    PrivateLateBoundObject.Scope = value
                End If
            End Set
        End Property

        'Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property AutoCommit() As Boolean
            Get
                Return AutoCommitProp
            End Get
            Set(ByVal value As Boolean)
                AutoCommitProp = value
            End Set
        End Property

        'The ManagementPath of the underlying WMI object.
        <Browsable(True)> _
        Public Property Path() As System.Management.ManagementPath
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Path
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementPath)
                If (isEmbedded = False) Then
                    If (CheckIfProperClass(Nothing, value, Nothing) <> True) Then
                        Throw New System.ArgumentException("Class name does not match.")
                    End If
                    PrivateLateBoundObject.Path = value
                End If
            End Set
        End Property

        'Public static scope property which is used by the various methods.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Shared Property StaticScope() As System.Management.ManagementScope
            Get
                Return statMgmtScope
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                statMgmtScope = value
            End Set
        End Property

#End Region

#Region "Attributes"
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The textual identification of the contact person" & Global.Microsoft.VisualBasic.ChrW(10) & "                      for this m" & _
            "anaged node, together with information" & Global.Microsoft.VisualBasic.ChrW(10) & "                      on how to contact t" & _
            "his person.")> _
        Public Property sysContact() As String
            Get
                Return CType(curObj("sysContact"), String)
            End Get
            Set(ByVal value As String)
                curObj("sysContact") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("A textual description of the entity.  This value" & Global.Microsoft.VisualBasic.ChrW(10) & "                      should inc" & _
            "lude the full name and version" & Global.Microsoft.VisualBasic.ChrW(10) & "                      identification of the syste" & _
            "m's hardware type," & Global.Microsoft.VisualBasic.ChrW(10) & "                      software operating-system, and networki" & _
            "ng" & Global.Microsoft.VisualBasic.ChrW(10) & "                      software.  It is mandatory that this only contain" & Global.Microsoft.VisualBasic.ChrW(10) & "     " & _
            "                 printable ASCII characters.")> _
        Public ReadOnly Property sysDescr() As String
            Get
                Return CType(curObj("sysDescr"), String)
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The physical location of this node (e.g.," & Global.Microsoft.VisualBasic.ChrW(10) & "                      `telephone closet" & _
            ", 3rd floor').")> _
        Public Property sysLocation() As String
            Get
                Return CType(curObj("sysLocation"), String)
            End Get
            Set(ByVal value As String)
                curObj("sysLocation") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("An administratively-assigned name for this" & Global.Microsoft.VisualBasic.ChrW(10) & "                      managed node.  B" & _
            "y convention, this is the node's" & Global.Microsoft.VisualBasic.ChrW(10) & "                      fully-qualified domain na" & _
            "me.")> _
        Public Property sysName() As String
            Get
                Return CType(curObj("sysName"), String)
            End Get
            Set(ByVal value As String)
                curObj("sysName") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The vendor's authoritative identification of the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      network ma" & _
            "nagement subsystem contained in the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      entity.  This value is" & _
            " allocated within the SMI" & Global.Microsoft.VisualBasic.ChrW(10) & "                      enterprises subtree (1.3.6.1.4.1" & _
            ") and provides an" & Global.Microsoft.VisualBasic.ChrW(10) & "                      easy and unambiguous means for determini" & _
            "ng `what" & Global.Microsoft.VisualBasic.ChrW(10) & "                      kind of box' is being managed.  For example, if" & Global.Microsoft.VisualBasic.ChrW(10) & " " & _
            "                     vendor `Flintstones, Inc.' was assigned the" & Global.Microsoft.VisualBasic.ChrW(10) & "               " & _
            "       subtree 1.3.6.1.4.1.4242, it could assign the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ident" & _
            "ifier 1.3.6.1.4.1.4242.1.1 to its `Fred" & Global.Microsoft.VisualBasic.ChrW(10) & "                      Router'.")> _
        Public ReadOnly Property sysObjectID() As String
            Get
                Return CType(curObj("sysObjectID"), String)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IssysServicesNull() As Boolean
            Get
                If (curObj("sysServices") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("A value which indicates the set of services that" & Global.Microsoft.VisualBasic.ChrW(10) & "                      this entit" & _
            "y primarily offers." & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10) & "                      The value is a sum.  This sum initial" & _
            "ly takes the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      value zero, Then, for each layer, L, in the r" & _
            "ange" & Global.Microsoft.VisualBasic.ChrW(10) & "                      1 through 7, that this node performs transactions" & Global.Microsoft.VisualBasic.ChrW(10) & "   " & _
            "                   for, 2 raised to (L - 1) is added to the sum.  For" & Global.Microsoft.VisualBasic.ChrW(10) & "          " & _
            "            example, a node which performs primarily routing" & Global.Microsoft.VisualBasic.ChrW(10) & "                   " & _
            "   functions would have a value of 4 (2^(3-1)).  In" & Global.Microsoft.VisualBasic.ChrW(10) & "                      contra" & _
            "st, a node which is a host offering" & Global.Microsoft.VisualBasic.ChrW(10) & "                      application services w" & _
            "ould have a value of 72" & Global.Microsoft.VisualBasic.ChrW(10) & "                      (2^(4-1) + 2^(7-1)).  Note that in" & _
            " the context of" & Global.Microsoft.VisualBasic.ChrW(10) & "                      the Internet suite of protocols, values sh" & _
            "ould be" & Global.Microsoft.VisualBasic.ChrW(10) & "                      calculated accordingly:" & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10) & "                         " & _
            "  layer  functionality" & Global.Microsoft.VisualBasic.ChrW(10) & "                               1  physical (e.g., repeate" & _
            "rs)" & Global.Microsoft.VisualBasic.ChrW(10) & "                               2  datalink/subnetwork (e.g., bridges)" & Global.Microsoft.VisualBasic.ChrW(10) & "      " & _
            "                         3  internet (e.g., IP gateways)" & Global.Microsoft.VisualBasic.ChrW(10) & "                       " & _
            "        4  end-to-end  (e.g., IP hosts)" & Global.Microsoft.VisualBasic.ChrW(10) & "                               7  applic" & _
            "ations (e.g., mail relays)" & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10) & "                      For systems including OSI prot" & _
            "ocols, layers 5 and" & Global.Microsoft.VisualBasic.ChrW(10) & "                      6 may also be counted."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property sysServices() As Integer
            Get
                If (curObj("sysServices") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("sysServices"), Integer)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IssysUpTimeNull() As Boolean
            Get
                If (curObj("sysUpTime") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The time (in hundredths of a second) since the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      network mana" & _
            "gement portion of the system was last" & Global.Microsoft.VisualBasic.ChrW(10) & "                      re-initialized."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property sysUpTime() As UInteger
            Get
                If (curObj("sysUpTime") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("sysUpTime"), UInteger)
            End Get
        End Property

#End Region

#Region "the rest of it"

        Private Overloads Function CheckIfProperClass(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal OptionsParam As System.Management.ObjectGetOptions) As Boolean
            If ((Not (path) Is Nothing) _
                        AndAlso (String.Compare(path.ClassName, Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Return CheckIfProperClass(New System.Management.ManagementObject(mgmtScope, path, OptionsParam))
            End If
        End Function

        Private Overloads Function CheckIfProperClass(ByVal theObj As System.Management.ManagementBaseObject) As Boolean
            If ((Not (theObj) Is Nothing) _
                        AndAlso (String.Compare(CType(theObj("__CLASS"), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Dim parentClasses As System.Array = CType(theObj("__DERIVATION"), System.Array)
                If (Not (parentClasses) Is Nothing) Then
                    Dim count As Integer = 0
                    count = 0
                    Do While (count < parentClasses.Length)
                        If (String.Compare(CType(parentClasses.GetValue(count), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0) Then
                            Return True
                        End If
                        count = (count + 1)
                    Loop
                End If
            End If
            Return False
        End Function

        Private Sub ResetsysContact()
            curObj("sysContact") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Sub ResetsysLocation()
            curObj("sysLocation") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Sub ResetsysName()
            curObj("sysName") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Function ShouldSerializesysServices() As Boolean
            If (Me.IssysServicesNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializesysUpTime() As Boolean
            If (Me.IssysUpTimeNull = False) Then
                Return True
            End If
            Return False
        End Function

        <Browsable(True)> _
        Public Overloads Sub CommitObject()
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        <Browsable(True)> _
        Public Overloads Sub CommitObject(ByVal putOptions As System.Management.PutOptions)
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put(putOptions)
            End If
        End Sub

        Private Sub Initialize()
            AutoCommitProp = True
            isEmbedded = False
        End Sub

        Private Shared Function ConstructPath() As String
            Return "root\snmp\smir:snmp_rfc1213_mib_system=@"
        End Function

        Private Sub InitializeObject(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            Initialize()
            If (Not (path) Is Nothing) Then
                If (CheckIfProperClass(mgmtScope, path, getOptions) <> True) Then
                    Throw New System.ArgumentException("Class name does not match.")
                End If
            End If
            PrivateLateBoundObject = New System.Management.ManagementObject(mgmtScope, path, getOptions)
            PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
            curObj = PrivateLateBoundObject
        End Sub

        <Browsable(True)> _
        Public Shared Function CreateInstance() As Rfc1213_mib_system
            Dim mgmtScope As System.Management.ManagementScope = Nothing
            If (statMgmtScope Is Nothing) Then
                mgmtScope = New System.Management.ManagementScope
                mgmtScope.Path.NamespacePath = CreatedWmiNamespace
            Else
                mgmtScope = statMgmtScope
            End If
            Dim mgmtPath As System.Management.ManagementPath = New System.Management.ManagementPath(CreatedClassName)
            Dim tmpMgmtClass As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, mgmtPath, Nothing)
            Return New Rfc1213_mib_system(tmpMgmtClass.CreateInstance)
        End Function

        <Browsable(True)> _
        Public Sub Delete()
            PrivateLateBoundObject.Delete()
        End Sub

        'TypeConverter to handle null values for ValueType properties
        Public Class WMIValueTypeConverter
            Inherits TypeConverter

            Private baseConverter As TypeConverter

            Private baseType As System.Type

            Public Sub New(ByVal inBaseType As System.Type)
                MyBase.New()
                baseConverter = TypeDescriptor.GetConverter(inBaseType)
                baseType = inBaseType
            End Sub

            Public Overloads Overrides Function CanConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal srcType As System.Type) As Boolean
                Return baseConverter.CanConvertFrom(context, srcType)
            End Function

            Public Overloads Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As System.Type) As Boolean
                Return baseConverter.CanConvertTo(context, destinationType)
            End Function

            Public Overloads Overrides Function ConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
                Return baseConverter.ConvertFrom(context, culture, value)
            End Function

            Public Overloads Overrides Function CreateInstance(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal dictionary As System.Collections.IDictionary) As Object
                Return baseConverter.CreateInstance(context, dictionary)
            End Function

            Public Overloads Overrides Function GetCreateInstanceSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetCreateInstanceSupported(context)
            End Function

            Public Overloads Overrides Function GetProperties(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal value As Object, ByVal attributeVar() As System.Attribute) As PropertyDescriptorCollection
                Return baseConverter.GetProperties(context, value, attributeVar)
            End Function

            Public Overloads Overrides Function GetPropertiesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetPropertiesSupported(context)
            End Function

            Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
                Return baseConverter.GetStandardValues(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesExclusive(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesSupported(context)
            End Function

            Public Overloads Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
                If (baseType.BaseType Is GetType(System.[Enum])) Then
                    If (value.GetType Is destinationType) Then
                        Return value
                    End If
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return "NULL_ENUM_VALUE"
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((baseType Is GetType(Boolean)) _
                            AndAlso (baseType.BaseType Is GetType(System.ValueType))) Then
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return ""
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((Not (context) Is Nothing) _
                            AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                    Return ""
                End If
                Return baseConverter.ConvertTo(context, culture, value, destinationType)
            End Function
        End Class

        'Embedded class to represent WMI system Properties.
        <TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _
        Public Class ManagementSystemProperties

            Private PrivateLateBoundObject As System.Management.ManagementBaseObject

            Public Sub New(ByVal ManagedObject As System.Management.ManagementBaseObject)
                MyBase.New()
                PrivateLateBoundObject = ManagedObject
            End Sub

            <Browsable(True)> _
            Public ReadOnly Property GENUS() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__GENUS"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [CLASS]() As String
                Get
                    Return CType(PrivateLateBoundObject("__CLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SUPERCLASS() As String
                Get
                    Return CType(PrivateLateBoundObject("__SUPERCLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DYNASTY() As String
                Get
                    Return CType(PrivateLateBoundObject("__DYNASTY"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property RELPATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__RELPATH"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PROPERTY_COUNT() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__PROPERTY_COUNT"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DERIVATION() As String()
                Get
                    Return CType(PrivateLateBoundObject("__DERIVATION"), String())
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SERVER() As String
                Get
                    Return CType(PrivateLateBoundObject("__SERVER"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [NAMESPACE]() As String
                Get
                    Return CType(PrivateLateBoundObject("__NAMESPACE"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__PATH"), String)
                End Get
            End Property
        End Class

#End Region

    End Class ' Rfc1213_mib_system


    'Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
    'Functions Is<PropertyName>Null() are used to check if a property is NULL.
    'Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
    'Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
    'An Early Bound class generated for the WMI class.snmp_rfc1213_mib_ifTable
    Public Class Rfc1213_mib_ifTable
        Inherits System.ComponentModel.Component






#Region "begin"

        'Private property to hold the WMI namespace in which the class resides.
        Private Shared CreatedWmiNamespace As String = "root\snmp\smir"

        'Private property to hold the name of WMI class which created this class.
        Private Shared CreatedClassName As String = "snmp_rfc1213_mib_ifTable"

        'Private member variable to hold the ManagementScope which is used by the various methods.
        Private Shared statMgmtScope As System.Management.ManagementScope = Nothing

        Private PrivateSystemProperties As ManagementSystemProperties

        'Underlying lateBound WMI object.
        Private PrivateLateBoundObject As System.Management.ManagementObject

        'Member variable to store the 'automatic commit' behavior for the class.
        Private AutoCommitProp As Boolean

        'Private variable to hold the embedded property representing the instance.
        Private embeddedObj As System.Management.ManagementBaseObject

        'The current WMI object used
        Private curObj As System.Management.ManagementBaseObject

        'Flag to indicate if the instance is an embedded object.
        Private isEmbedded As Boolean

        'Below are different overloads of constructors to initialize an instance of the class with a WMI object.
        Public Sub New()
            MyBase.New()
            Me.InitializeObject(Nothing, Nothing, Nothing)
        End Sub

        Public Sub New(ByVal keyifIndex As Integer)
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_ifTable.ConstructPath(keyifIndex)), Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal keyifIndex As Integer)
            MyBase.New()
            Me.InitializeObject(CType(mgmtScope, System.Management.ManagementScope), New System.Management.ManagementPath(Rfc1213_mib_ifTable.ConstructPath(keyifIndex)), Nothing)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(Nothing, path, getOptions)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, Nothing)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(Nothing, path, Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, getOptions)
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                PrivateLateBoundObject = theObject
                PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
                curObj = PrivateLateBoundObject
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementBaseObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                embeddedObj = theObject
                PrivateSystemProperties = New ManagementSystemProperties(theObject)
                curObj = embeddedObj
                isEmbedded = True
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        'Property returns the namespace of the WMI class.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property OriginatingNamespace() As String
            Get
                Return "root\snmp\smir"
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property ManagementClassName() As String
            Get
                Dim strRet As String = CreatedClassName
                If (Not (curObj) Is Nothing) Then
                    If (Not (curObj.ClassPath) Is Nothing) Then
                        strRet = CType(curObj("__CLASS"), String)
                        If ((strRet Is Nothing) _
                                    OrElse (strRet Is String.Empty)) Then
                            strRet = CreatedClassName
                        End If
                    End If
                End If
                Return strRet
            End Get
        End Property

        'Property pointing to an embedded object to get System properties of the WMI object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property SystemProperties() As ManagementSystemProperties
            Get
                Return PrivateSystemProperties
            End Get
        End Property

        'Property returning the underlying lateBound object.
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property LateBoundObject() As System.Management.ManagementBaseObject
            Get
                Return curObj
            End Get
        End Property

        'ManagementScope of the object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property Scope() As System.Management.ManagementScope
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Scope
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                If (isEmbedded = False) Then
                    PrivateLateBoundObject.Scope = value
                End If
            End Set
        End Property

        'Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property AutoCommit() As Boolean
            Get
                Return AutoCommitProp
            End Get
            Set(ByVal value As Boolean)
                AutoCommitProp = value
            End Set
        End Property

        'The ManagementPath of the underlying WMI object.
        <Browsable(True)> _
        Public Property Path() As System.Management.ManagementPath
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Path
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementPath)
                If (isEmbedded = False) Then
                    If (CheckIfProperClass(Nothing, value, Nothing) <> True) Then
                        Throw New System.ArgumentException("Class name does not match.")
                    End If
                    PrivateLateBoundObject.Path = value
                End If
            End Set
        End Property

        'Public static scope property which is used by the various methods.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Shared Property StaticScope() As System.Management.ManagementScope
            Get
                Return statMgmtScope
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                statMgmtScope = value
            End Set
        End Property
#End Region


#Region "attributes"


        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The desired state of the interface.  The" & Global.Microsoft.VisualBasic.ChrW(10) & "                      testing(3) state i" & _
            "ndicates that no operational" & Global.Microsoft.VisualBasic.ChrW(10) & "                      packets can be passed.")> _
        Public Property ifAdminStatus() As String
            Get
                Return CType(curObj("ifAdminStatus"), String)
            End Get
            Set(ByVal value As String)
                curObj("ifAdminStatus") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("A textual string containing information about the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      interface" & _
            ".  This string should include the name of" & Global.Microsoft.VisualBasic.ChrW(10) & "                      the manufacturer" & _
            ", the product name and the version" & Global.Microsoft.VisualBasic.ChrW(10) & "                      of the hardware interfa" & _
            "ce.")> _
        Public ReadOnly Property ifDescr() As String
            Get
                Return CType(curObj("ifDescr"), String)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifIndexNull() As Boolean
            Get
                If (curObj("ifIndex") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("A unique value for each interface.  Its value" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ranges betwee" & _
            "n 1 and the value of ifNumber.  The" & Global.Microsoft.VisualBasic.ChrW(10) & "                      value for each interfa" & _
            "ce must remain constant at" & Global.Microsoft.VisualBasic.ChrW(10) & "                      least from one re-initializatio" & _
            "n of the entity's" & Global.Microsoft.VisualBasic.ChrW(10) & "                      network management system to the next re" & _
            "-" & Global.Microsoft.VisualBasic.ChrW(10) & "                      initialization."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifIndex() As Integer
            Get
                If (curObj("ifIndex") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ifIndex"), Integer)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifInDiscardsNull() As Boolean
            Get
                If (curObj("ifInDiscards") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of inbound packets which were chosen" & Global.Microsoft.VisualBasic.ChrW(10) & "                      to be disca" & _
            "rded even though no errors had been" & Global.Microsoft.VisualBasic.ChrW(10) & "                      detected to prevent th" & _
            "eir being deliverable to a" & Global.Microsoft.VisualBasic.ChrW(10) & "                      higher-layer protocol.  One pos" & _
            "sible reason for" & Global.Microsoft.VisualBasic.ChrW(10) & "                      discarding such a packet could be to free" & _
            " up" & Global.Microsoft.VisualBasic.ChrW(10) & "                      buffer space."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifInDiscards() As UInteger
            Get
                If (curObj("ifInDiscards") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifInDiscards"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifInErrorsNull() As Boolean
            Get
                If (curObj("ifInErrors") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of inbound packets that contained" & Global.Microsoft.VisualBasic.ChrW(10) & "                      errors prevent" & _
            "ing them from being deliverable to a" & Global.Microsoft.VisualBasic.ChrW(10) & "                      higher-layer protocol" & _
            "."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifInErrors() As UInteger
            Get
                If (curObj("ifInErrors") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifInErrors"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifInNUcastPktsNull() As Boolean
            Get
                If (curObj("ifInNUcastPkts") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of non-unicast (i.e., subnetwork-" & Global.Microsoft.VisualBasic.ChrW(10) & "                      broadcast or s" & _
            "ubnetwork-multicast) packets" & Global.Microsoft.VisualBasic.ChrW(10) & "                      delivered to a higher-layer p" & _
            "rotocol."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifInNUcastPkts() As UInteger
            Get
                If (curObj("ifInNUcastPkts") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifInNUcastPkts"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifInOctetsNull() As Boolean
            Get
                If (curObj("ifInOctets") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The total number of octets received on the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      interface, inclu" & _
            "ding framing characters."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifInOctets() As UInteger
            Get
                If (curObj("ifInOctets") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifInOctets"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifInUcastPktsNull() As Boolean
            Get
                If (curObj("ifInUcastPkts") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of subnetwork-unicast packets" & Global.Microsoft.VisualBasic.ChrW(10) & "                      delivered to a hig" & _
            "her-layer protocol."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifInUcastPkts() As UInteger
            Get
                If (curObj("ifInUcastPkts") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifInUcastPkts"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifInUnknownProtosNull() As Boolean
            Get
                If (curObj("ifInUnknownProtos") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of packets received via the interface" & Global.Microsoft.VisualBasic.ChrW(10) & "                      which were" & _
            " discarded because of an unknown or" & Global.Microsoft.VisualBasic.ChrW(10) & "                      unsupported protocol."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifInUnknownProtos() As UInteger
            Get
                If (curObj("ifInUnknownProtos") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifInUnknownProtos"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifLastChangeNull() As Boolean
            Get
                If (curObj("ifLastChange") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The value of sysUpTime at the time the interface" & Global.Microsoft.VisualBasic.ChrW(10) & "                      entered it" & _
            "s current operational state.  If the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      current state was ent" & _
            "ered prior to the last re-" & Global.Microsoft.VisualBasic.ChrW(10) & "                      initialization of the local net" & _
            "work management" & Global.Microsoft.VisualBasic.ChrW(10) & "                      subsystem, then this object contains a zer" & _
            "o" & Global.Microsoft.VisualBasic.ChrW(10) & "                      value."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifLastChange() As UInteger
            Get
                If (curObj("ifLastChange") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifLastChange"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifMtuNull() As Boolean
            Get
                If (curObj("ifMtu") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The size of the largest datagram which can be" & Global.Microsoft.VisualBasic.ChrW(10) & "                      sent/received" & _
            " on the interface, specified in" & Global.Microsoft.VisualBasic.ChrW(10) & "                      octets.  For interfaces th" & _
            "at are used for" & Global.Microsoft.VisualBasic.ChrW(10) & "                      transmitting network datagrams, this is th" & _
            "e size" & Global.Microsoft.VisualBasic.ChrW(10) & "                      of the largest network datagram that can be sent" & Global.Microsoft.VisualBasic.ChrW(10) & "  " & _
            "                    on the interface."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifMtu() As Integer
            Get
                If (curObj("ifMtu") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ifMtu"), Integer)
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The current operational state of the interface." & Global.Microsoft.VisualBasic.ChrW(10) & "                      The testing" & _
            "(3) state indicates that no operational" & Global.Microsoft.VisualBasic.ChrW(10) & "                      packets can be pas" & _
            "sed.")> _
        Public ReadOnly Property ifOperStatus() As String
            Get
                Return CType(curObj("ifOperStatus"), String)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifOutDiscardsNull() As Boolean
            Get
                If (curObj("ifOutDiscards") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of outbound packets which were chosen" & Global.Microsoft.VisualBasic.ChrW(10) & "                      to be disc" & _
            "arded even though no errors had been" & Global.Microsoft.VisualBasic.ChrW(10) & "                      detected to prevent t" & _
            "heir being transmitted.  One" & Global.Microsoft.VisualBasic.ChrW(10) & "                      possible reason for discardin" & _
            "g such a packet could" & Global.Microsoft.VisualBasic.ChrW(10) & "                      be to free up buffer space."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifOutDiscards() As UInteger
            Get
                If (curObj("ifOutDiscards") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifOutDiscards"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifOutErrorsNull() As Boolean
            Get
                If (curObj("ifOutErrors") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of outbound packets that could not be" & Global.Microsoft.VisualBasic.ChrW(10) & "                      transmitte" & _
            "d because of errors."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifOutErrors() As UInteger
            Get
                If (curObj("ifOutErrors") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifOutErrors"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifOutNUcastPktsNull() As Boolean
            Get
                If (curObj("ifOutNUcastPkts") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The total number of packets that higher-level" & Global.Microsoft.VisualBasic.ChrW(10) & "                      protocols req" & _
            "uested be transmitted to a non-" & Global.Microsoft.VisualBasic.ChrW(10) & "                      unicast (i.e., a subnetwor" & _
            "k-broadcast or" & Global.Microsoft.VisualBasic.ChrW(10) & "                      subnetwork-multicast) address, including th" & _
            "ose" & Global.Microsoft.VisualBasic.ChrW(10) & "                      that were discarded or not sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifOutNUcastPkts() As UInteger
            Get
                If (curObj("ifOutNUcastPkts") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifOutNUcastPkts"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifOutOctetsNull() As Boolean
            Get
                If (curObj("ifOutOctets") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The total number of octets transmitted out of the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      interface" & _
            ", including framing characters."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifOutOctets() As UInteger
            Get
                If (curObj("ifOutOctets") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifOutOctets"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifOutQLenNull() As Boolean
            Get
                If (curObj("ifOutQLen") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The length of the output packet queue (in" & Global.Microsoft.VisualBasic.ChrW(10) & "                      packets)."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifOutQLen() As UInteger
            Get
                If (curObj("ifOutQLen") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifOutQLen"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifOutUcastPktsNull() As Boolean
            Get
                If (curObj("ifOutUcastPkts") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The total number of packets that higher-level" & Global.Microsoft.VisualBasic.ChrW(10) & "                      protocols req" & _
            "uested be transmitted to a" & Global.Microsoft.VisualBasic.ChrW(10) & "                      subnetwork-unicast address, inc" & _
            "luding those that" & Global.Microsoft.VisualBasic.ChrW(10) & "                      were discarded or not sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifOutUcastPkts() As UInteger
            Get
                If (curObj("ifOutUcastPkts") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifOutUcastPkts"), UInteger)
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The interface's address at the protocol layer" & Global.Microsoft.VisualBasic.ChrW(10) & "                      immediately `" & _
            "below' the network layer in the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      protocol stack.  For inter" & _
            "faces which do not have" & Global.Microsoft.VisualBasic.ChrW(10) & "                      such an address (e.g., a serial li" & _
            "ne), this object" & Global.Microsoft.VisualBasic.ChrW(10) & "                      should contain an octet string of zero le" & _
            "ngth.")> _
        Public ReadOnly Property ifPhysAddress() As String
            Get
                Return CType(curObj("ifPhysAddress"), String)
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("A reference to MIB definitions specific to the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      particular m" & _
            "edia being used to realize the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      interface.  For example, if" & _
            " the interface is" & Global.Microsoft.VisualBasic.ChrW(10) & "                      realized by an ethernet, then the value " & _
            "of this" & Global.Microsoft.VisualBasic.ChrW(10) & "                      object refers to a document defining objects" & Global.Microsoft.VisualBasic.ChrW(10) & "     " & _
            "                 specific to ethernet.  If this information is not" & Global.Microsoft.VisualBasic.ChrW(10) & "             " & _
            "         present, its value should be set to the OBJECT" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ID" & _
            "ENTIFIER { 0 0 }, which is a syntactically valid" & Global.Microsoft.VisualBasic.ChrW(10) & "                      object id" & _
            "entifier, and any conformant" & Global.Microsoft.VisualBasic.ChrW(10) & "                      implementation of ASN.1 and B" & _
            "ER must be able to" & Global.Microsoft.VisualBasic.ChrW(10) & "                      generate and recognize this value.")> _
        Public ReadOnly Property ifSpecific() As String
            Get
                Return CType(curObj("ifSpecific"), String)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifSpeedNull() As Boolean
            Get
                If (curObj("ifSpeed") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("An estimate of the interface's current bandwidth" & Global.Microsoft.VisualBasic.ChrW(10) & "                      in bits pe" & _
            "r second.  For interfaces which do not" & Global.Microsoft.VisualBasic.ChrW(10) & "                      vary in bandwidth o" & _
            "r for those where no accurate" & Global.Microsoft.VisualBasic.ChrW(10) & "                      estimation can be made, this" & _
            " object should contain" & Global.Microsoft.VisualBasic.ChrW(10) & "                      the nominal bandwidth."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifSpeed() As UInteger
            Get
                If (curObj("ifSpeed") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("ifSpeed"), UInteger)
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The type of interface.  Additional values for ifType" & Global.Microsoft.VisualBasic.ChrW(10) & " " & Global.Microsoft.VisualBasic.ChrW(9) & "               are assigne" & _
            "d by the Internet Assigned Numbers" & Global.Microsoft.VisualBasic.ChrW(10) & "         " & Global.Microsoft.VisualBasic.ChrW(9) & "       Authority (IANA), through up" & _
            "dating the syntax of the" & Global.Microsoft.VisualBasic.ChrW(10) & " " & Global.Microsoft.VisualBasic.ChrW(9) & "               IANAifType textual convention.")> _
        Public ReadOnly Property ifType() As String
            Get
                Return CType(curObj("ifType"), String)
            End Get
        End Property

#End Region


#Region "the rest"



        Private Overloads Function CheckIfProperClass(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal OptionsParam As System.Management.ObjectGetOptions) As Boolean
            If ((Not (path) Is Nothing) _
                        AndAlso (String.Compare(path.ClassName, Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Return CheckIfProperClass(New System.Management.ManagementObject(mgmtScope, path, OptionsParam))
            End If
        End Function

        Private Overloads Function CheckIfProperClass(ByVal theObj As System.Management.ManagementBaseObject) As Boolean
            If ((Not (theObj) Is Nothing) _
                        AndAlso (String.Compare(CType(theObj("__CLASS"), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Dim parentClasses As System.Array = CType(theObj("__DERIVATION"), System.Array)
                If (Not (parentClasses) Is Nothing) Then
                    Dim count As Integer = 0
                    count = 0
                    Do While (count < parentClasses.Length)
                        If (String.Compare(CType(parentClasses.GetValue(count), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0) Then
                            Return True
                        End If
                        count = (count + 1)
                    Loop
                End If
            End If
            Return False
        End Function

        Private Sub ResetifAdminStatus()
            curObj("ifAdminStatus") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Function ShouldSerializeifIndex() As Boolean
            If (Me.IsifIndexNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifInDiscards() As Boolean
            If (Me.IsifInDiscardsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifInErrors() As Boolean
            If (Me.IsifInErrorsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifInNUcastPkts() As Boolean
            If (Me.IsifInNUcastPktsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifInOctets() As Boolean
            If (Me.IsifInOctetsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifInUcastPkts() As Boolean
            If (Me.IsifInUcastPktsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifInUnknownProtos() As Boolean
            If (Me.IsifInUnknownProtosNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifLastChange() As Boolean
            If (Me.IsifLastChangeNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifMtu() As Boolean
            If (Me.IsifMtuNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifOutDiscards() As Boolean
            If (Me.IsifOutDiscardsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifOutErrors() As Boolean
            If (Me.IsifOutErrorsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifOutNUcastPkts() As Boolean
            If (Me.IsifOutNUcastPktsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifOutOctets() As Boolean
            If (Me.IsifOutOctetsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifOutQLen() As Boolean
            If (Me.IsifOutQLenNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifOutUcastPkts() As Boolean
            If (Me.IsifOutUcastPktsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeifSpeed() As Boolean
            If (Me.IsifSpeedNull = False) Then
                Return True
            End If
            Return False
        End Function

        <Browsable(True)> _
        Public Overloads Sub CommitObject()
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        <Browsable(True)> _
        Public Overloads Sub CommitObject(ByVal putOptions As System.Management.PutOptions)
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put(putOptions)
            End If
        End Sub

        Private Sub Initialize()
            AutoCommitProp = True
            isEmbedded = False
        End Sub

        Private Shared Function ConstructPath(ByVal keyifIndex As Integer) As String
            Dim strPath As String = "root\snmp\smir:snmp_rfc1213_mib_ifTable"
            strPath = String.Concat(strPath, String.Concat(".ifIndex=", CType(keyifIndex, System.Int32).ToString))
            Return strPath
        End Function

        Private Sub InitializeObject(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            Initialize()
            If (Not (path) Is Nothing) Then
                If (CheckIfProperClass(mgmtScope, path, getOptions) <> True) Then
                    Throw New System.ArgumentException("Class name does not match.")
                End If
            End If
            PrivateLateBoundObject = New System.Management.ManagementObject(mgmtScope, path, getOptions)
            PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
            curObj = PrivateLateBoundObject
        End Sub

        'Different overloads of GetInstances() help in enumerating instances of the WMI class.
        Public Overloads Shared Function GetInstances() As Rfc1213_mib_ifTableCollection
            Return GetInstances(Nothing, Nothing, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal condition As String) As Rfc1213_mib_ifTableCollection
            Return GetInstances(Nothing, condition, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal selectedProperties() As System.String) As Rfc1213_mib_ifTableCollection
            Return GetInstances(Nothing, Nothing, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal condition As String, ByVal selectedProperties() As System.String) As Rfc1213_mib_ifTableCollection
            Return GetInstances(Nothing, condition, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal enumOptions As System.Management.EnumerationOptions) As Rfc1213_mib_ifTableCollection
            If (mgmtScope Is Nothing) Then
                If (statMgmtScope Is Nothing) Then
                    mgmtScope = New System.Management.ManagementScope
                    mgmtScope.Path.NamespacePath = "root\snmp\smir"
                Else
                    mgmtScope = statMgmtScope
                End If
            End If
            Dim pathObj As System.Management.ManagementPath = New System.Management.ManagementPath
            pathObj.ClassName = "snmp_rfc1213_mib_ifTable"
            pathObj.NamespacePath = "root\snmp\smir"
            Dim clsObject As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, pathObj, Nothing)
            If (enumOptions Is Nothing) Then
                enumOptions = New System.Management.EnumerationOptions
                enumOptions.EnsureLocatable = True
            End If
            Return New Rfc1213_mib_ifTableCollection(clsObject.GetInstances(enumOptions))
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal condition As String) As Rfc1213_mib_ifTableCollection
            Return GetInstances(mgmtScope, condition, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal selectedProperties() As System.String) As Rfc1213_mib_ifTableCollection
            Return GetInstances(mgmtScope, Nothing, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal condition As String, ByVal selectedProperties() As System.String) As Rfc1213_mib_ifTableCollection
            If (mgmtScope Is Nothing) Then
                If (statMgmtScope Is Nothing) Then
                    mgmtScope = New System.Management.ManagementScope
                    mgmtScope.Path.NamespacePath = "root\snmp\smir"
                Else
                    mgmtScope = statMgmtScope
                End If
            End If
            Dim ObjectSearcher As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher(mgmtScope, New SelectQuery("snmp_rfc1213_mib_ifTable", condition, selectedProperties))
            Dim enumOptions As System.Management.EnumerationOptions = New System.Management.EnumerationOptions
            enumOptions.EnsureLocatable = True
            ObjectSearcher.Options = enumOptions
            Return New Rfc1213_mib_ifTableCollection(ObjectSearcher.Get)
        End Function

        <Browsable(True)> _
        Public Shared Function CreateInstance() As Rfc1213_mib_ifTable
            Dim mgmtScope As System.Management.ManagementScope = Nothing
            If (statMgmtScope Is Nothing) Then
                mgmtScope = New System.Management.ManagementScope
                mgmtScope.Path.NamespacePath = CreatedWmiNamespace
            Else
                mgmtScope = statMgmtScope
            End If
            Dim mgmtPath As System.Management.ManagementPath = New System.Management.ManagementPath(CreatedClassName)
            Dim tmpMgmtClass As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, mgmtPath, Nothing)
            Return New Rfc1213_mib_ifTable(tmpMgmtClass.CreateInstance)
        End Function

        <Browsable(True)> _
        Public Sub Delete()
            PrivateLateBoundObject.Delete()
        End Sub

        'Enumerator implementation for enumerating instances of the class.
        Public Class Rfc1213_mib_ifTableCollection
            Inherits Object
            Implements ICollection

            Private privColObj As ManagementObjectCollection

            Public Sub New(ByVal objCollection As ManagementObjectCollection)
                MyBase.New()
                privColObj = objCollection
            End Sub

            Public Overridable ReadOnly Property Count() As Integer Implements System.Collections.ICollection.Count
                Get
                    Return privColObj.Count
                End Get
            End Property

            Public Overridable ReadOnly Property IsSynchronized() As Boolean Implements System.Collections.ICollection.IsSynchronized
                Get
                    Return privColObj.IsSynchronized
                End Get
            End Property

            Public Overridable ReadOnly Property SyncRoot() As Object Implements System.Collections.ICollection.SyncRoot
                Get
                    Return Me
                End Get
            End Property

            Public Overridable Sub CopyTo(ByVal array As System.Array, ByVal index As Integer) Implements System.Collections.ICollection.CopyTo
                privColObj.CopyTo(array, index)
                Dim nCtr As Integer
                nCtr = 0
                Do While (nCtr < array.Length)
                    array.SetValue(New Rfc1213_mib_ifTable(CType(array.GetValue(nCtr), System.Management.ManagementObject)), nCtr)
                    nCtr = (nCtr + 1)
                Loop
            End Sub

            Public Overridable Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
                Return New Rfc1213_mib_ifTableEnumerator(privColObj.GetEnumerator)
            End Function

            Public Class Rfc1213_mib_ifTableEnumerator
                Inherits Object
                Implements System.Collections.IEnumerator

                Private privObjEnum As ManagementObjectCollection.ManagementObjectEnumerator

                Public Sub New(ByVal objEnum As ManagementObjectCollection.ManagementObjectEnumerator)
                    MyBase.New()
                    privObjEnum = objEnum
                End Sub

                Public Overridable ReadOnly Property Current() As Object Implements System.Collections.IEnumerator.Current
                    Get
                        Return New Rfc1213_mib_ifTable(CType(privObjEnum.Current, System.Management.ManagementObject))
                    End Get
                End Property

                Public Overridable Function MoveNext() As Boolean Implements System.Collections.IEnumerator.MoveNext
                    Return privObjEnum.MoveNext
                End Function

                Public Overridable Sub Reset() Implements System.Collections.IEnumerator.Reset
                    privObjEnum.Reset()
                End Sub
            End Class
        End Class

        'TypeConverter to handle null values for ValueType properties
        Public Class WMIValueTypeConverter
            Inherits TypeConverter

            Private baseConverter As TypeConverter

            Private baseType As System.Type

            Public Sub New(ByVal inBaseType As System.Type)
                MyBase.New()
                baseConverter = TypeDescriptor.GetConverter(inBaseType)
                baseType = inBaseType
            End Sub

            Public Overloads Overrides Function CanConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal srcType As System.Type) As Boolean
                Return baseConverter.CanConvertFrom(context, srcType)
            End Function

            Public Overloads Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As System.Type) As Boolean
                Return baseConverter.CanConvertTo(context, destinationType)
            End Function

            Public Overloads Overrides Function ConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
                Return baseConverter.ConvertFrom(context, culture, value)
            End Function

            Public Overloads Overrides Function CreateInstance(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal dictionary As System.Collections.IDictionary) As Object
                Return baseConverter.CreateInstance(context, dictionary)
            End Function

            Public Overloads Overrides Function GetCreateInstanceSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetCreateInstanceSupported(context)
            End Function

            Public Overloads Overrides Function GetProperties(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal value As Object, ByVal attributeVar() As System.Attribute) As PropertyDescriptorCollection
                Return baseConverter.GetProperties(context, value, attributeVar)
            End Function

            Public Overloads Overrides Function GetPropertiesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetPropertiesSupported(context)
            End Function

            Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
                Return baseConverter.GetStandardValues(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesExclusive(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesSupported(context)
            End Function

            Public Overloads Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
                If (baseType.BaseType Is GetType(System.[Enum])) Then
                    If (value.GetType Is destinationType) Then
                        Return value
                    End If
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return "NULL_ENUM_VALUE"
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((baseType Is GetType(Boolean)) _
                            AndAlso (baseType.BaseType Is GetType(System.ValueType))) Then
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return ""
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((Not (context) Is Nothing) _
                            AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                    Return ""
                End If
                Return baseConverter.ConvertTo(context, culture, value, destinationType)
            End Function
        End Class

        'Embedded class to represent WMI system Properties.
        <TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _
        Public Class ManagementSystemProperties

            Private PrivateLateBoundObject As System.Management.ManagementBaseObject

            Public Sub New(ByVal ManagedObject As System.Management.ManagementBaseObject)
                MyBase.New()
                PrivateLateBoundObject = ManagedObject
            End Sub

            <Browsable(True)> _
            Public ReadOnly Property GENUS() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__GENUS"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [CLASS]() As String
                Get
                    Return CType(PrivateLateBoundObject("__CLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SUPERCLASS() As String
                Get
                    Return CType(PrivateLateBoundObject("__SUPERCLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DYNASTY() As String
                Get
                    Return CType(PrivateLateBoundObject("__DYNASTY"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property RELPATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__RELPATH"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PROPERTY_COUNT() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__PROPERTY_COUNT"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DERIVATION() As String()
                Get
                    Return CType(PrivateLateBoundObject("__DERIVATION"), String())
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SERVER() As String
                Get
                    Return CType(PrivateLateBoundObject("__SERVER"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [NAMESPACE]() As String
                Get
                    Return CType(PrivateLateBoundObject("__NAMESPACE"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__PATH"), String)
                End Get
            End Property
        End Class

#End Region

    End Class ' Rfc1213_mib_ifTable


    'Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
    'Functions Is<PropertyName>Null() are used to check if a property is NULL.
    'Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
    'Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
    'An Early Bound class generated for the WMI class.snmp_rfc1213_mib_interfaces
    Public Class Rfc1213_mib_interfaces
        Inherits System.ComponentModel.Component



#Region " begin "

        'Private property to hold the WMI namespace in which the class resides.
        Private Shared CreatedWmiNamespace As String = "root\snmp\smir"

        'Private property to hold the name of WMI class which created this class.
        Private Shared CreatedClassName As String = "snmp_rfc1213_mib_interfaces"

        'Private member variable to hold the ManagementScope which is used by the various methods.
        Private Shared statMgmtScope As System.Management.ManagementScope = Nothing

        Private PrivateSystemProperties As ManagementSystemProperties

        'Underlying lateBound WMI object.
        Private PrivateLateBoundObject As System.Management.ManagementObject

        'Member variable to store the 'automatic commit' behavior for the class.
        Private AutoCommitProp As Boolean

        'Private variable to hold the embedded property representing the instance.
        Private embeddedObj As System.Management.ManagementBaseObject

        'The current WMI object used
        Private curObj As System.Management.ManagementBaseObject

        'Flag to indicate if the instance is an embedded object.
        Private isEmbedded As Boolean

        'Below are different overloads of constructors to initialize an instance of the class with a WMI object.
        Public Sub New()
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_interfaces.ConstructPath), Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope)
            MyBase.New()
            Me.InitializeObject(mgmtScope, New System.Management.ManagementPath(Rfc1213_mib_interfaces.ConstructPath), Nothing)
        End Sub

        Public Sub New(ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_interfaces.ConstructPath), getOptions)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, New System.Management.ManagementPath(Rfc1213_mib_interfaces.ConstructPath), getOptions)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(Nothing, path, Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, getOptions)
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                PrivateLateBoundObject = theObject
                PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
                curObj = PrivateLateBoundObject
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementBaseObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                embeddedObj = theObject
                PrivateSystemProperties = New ManagementSystemProperties(theObject)
                curObj = embeddedObj
                isEmbedded = True
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        'Property returns the namespace of the WMI class.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property OriginatingNamespace() As String
            Get
                Return "root\snmp\smir"
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property ManagementClassName() As String
            Get
                Dim strRet As String = CreatedClassName
                If (Not (curObj) Is Nothing) Then
                    If (Not (curObj.ClassPath) Is Nothing) Then
                        strRet = CType(curObj("__CLASS"), String)
                        If ((strRet Is Nothing) _
                                    OrElse (strRet Is String.Empty)) Then
                            strRet = CreatedClassName
                        End If
                    End If
                End If
                Return strRet
            End Get
        End Property

        'Property pointing to an embedded object to get System properties of the WMI object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property SystemProperties() As ManagementSystemProperties
            Get
                Return PrivateSystemProperties
            End Get
        End Property

        'Property returning the underlying lateBound object.
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property LateBoundObject() As System.Management.ManagementBaseObject
            Get
                Return curObj
            End Get
        End Property

        'ManagementScope of the object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property Scope() As System.Management.ManagementScope
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Scope
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                If (isEmbedded = False) Then
                    PrivateLateBoundObject.Scope = value
                End If
            End Set
        End Property

        'Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property AutoCommit() As Boolean
            Get
                Return AutoCommitProp
            End Get
            Set(ByVal value As Boolean)
                AutoCommitProp = value
            End Set
        End Property

        'The ManagementPath of the underlying WMI object.
        <Browsable(True)> _
        Public Property Path() As System.Management.ManagementPath
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Path
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementPath)
                If (isEmbedded = False) Then
                    If (CheckIfProperClass(Nothing, value, Nothing) <> True) Then
                        Throw New System.ArgumentException("Class name does not match.")
                    End If
                    PrivateLateBoundObject.Path = value
                End If
            End Set
        End Property

        'Public static scope property which is used by the various methods.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Shared Property StaticScope() As System.Management.ManagementScope
            Get
                Return statMgmtScope
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                statMgmtScope = value
            End Set
        End Property

#End Region



        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsifNumberNull() As Boolean
            Get
                If (curObj("ifNumber") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of network interfaces (regardless of" & Global.Microsoft.VisualBasic.ChrW(10) & "                      their curre" & _
            "nt state) present on this system."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ifNumber() As Integer
            Get
                If (curObj("ifNumber") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ifNumber"), Integer)
            End Get
        End Property


#Region "the rest of it"

        Private Overloads Function CheckIfProperClass(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal OptionsParam As System.Management.ObjectGetOptions) As Boolean
            If ((Not (path) Is Nothing) _
                        AndAlso (String.Compare(path.ClassName, Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Return CheckIfProperClass(New System.Management.ManagementObject(mgmtScope, path, OptionsParam))
            End If
        End Function

        Private Overloads Function CheckIfProperClass(ByVal theObj As System.Management.ManagementBaseObject) As Boolean
            If ((Not (theObj) Is Nothing) _
                        AndAlso (String.Compare(CType(theObj("__CLASS"), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Dim parentClasses As System.Array = CType(theObj("__DERIVATION"), System.Array)
                If (Not (parentClasses) Is Nothing) Then
                    Dim count As Integer = 0
                    count = 0
                    Do While (count < parentClasses.Length)
                        If (String.Compare(CType(parentClasses.GetValue(count), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0) Then
                            Return True
                        End If
                        count = (count + 1)
                    Loop
                End If
            End If
            Return False
        End Function

        Private Function ShouldSerializeifNumber() As Boolean
            If (Me.IsifNumberNull = False) Then
                Return True
            End If
            Return False
        End Function

        <Browsable(True)> _
        Public Overloads Sub CommitObject()
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        <Browsable(True)> _
        Public Overloads Sub CommitObject(ByVal putOptions As System.Management.PutOptions)
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put(putOptions)
            End If
        End Sub

        Private Sub Initialize()
            AutoCommitProp = True
            isEmbedded = False
        End Sub

        Private Shared Function ConstructPath() As String
            Return "root\snmp\smir:snmp_rfc1213_mib_interfaces=@"
        End Function

        Private Sub InitializeObject(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            Initialize()
            If (Not (path) Is Nothing) Then
                If (CheckIfProperClass(mgmtScope, path, getOptions) <> True) Then
                    Throw New System.ArgumentException("Class name does not match.")
                End If
            End If
            PrivateLateBoundObject = New System.Management.ManagementObject(mgmtScope, path, getOptions)
            PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
            curObj = PrivateLateBoundObject
        End Sub

        <Browsable(True)> _
        Public Shared Function CreateInstance() As Rfc1213_mib_interfaces
            Dim mgmtScope As System.Management.ManagementScope = Nothing
            If (statMgmtScope Is Nothing) Then
                mgmtScope = New System.Management.ManagementScope
                mgmtScope.Path.NamespacePath = CreatedWmiNamespace
            Else
                mgmtScope = statMgmtScope
            End If
            Dim mgmtPath As System.Management.ManagementPath = New System.Management.ManagementPath(CreatedClassName)
            Dim tmpMgmtClass As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, mgmtPath, Nothing)
            Return New Rfc1213_mib_interfaces(tmpMgmtClass.CreateInstance)
        End Function

        <Browsable(True)> _
        Public Sub Delete()
            PrivateLateBoundObject.Delete()
        End Sub

        'TypeConverter to handle null values for ValueType properties
        Public Class WMIValueTypeConverter
            Inherits TypeConverter

            Private baseConverter As TypeConverter

            Private baseType As System.Type

            Public Sub New(ByVal inBaseType As System.Type)
                MyBase.New()
                baseConverter = TypeDescriptor.GetConverter(inBaseType)
                baseType = inBaseType
            End Sub

            Public Overloads Overrides Function CanConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal srcType As System.Type) As Boolean
                Return baseConverter.CanConvertFrom(context, srcType)
            End Function

            Public Overloads Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As System.Type) As Boolean
                Return baseConverter.CanConvertTo(context, destinationType)
            End Function

            Public Overloads Overrides Function ConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
                Return baseConverter.ConvertFrom(context, culture, value)
            End Function

            Public Overloads Overrides Function CreateInstance(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal dictionary As System.Collections.IDictionary) As Object
                Return baseConverter.CreateInstance(context, dictionary)
            End Function

            Public Overloads Overrides Function GetCreateInstanceSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetCreateInstanceSupported(context)
            End Function

            Public Overloads Overrides Function GetProperties(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal value As Object, ByVal attributeVar() As System.Attribute) As PropertyDescriptorCollection
                Return baseConverter.GetProperties(context, value, attributeVar)
            End Function

            Public Overloads Overrides Function GetPropertiesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetPropertiesSupported(context)
            End Function

            Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
                Return baseConverter.GetStandardValues(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesExclusive(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesSupported(context)
            End Function

            Public Overloads Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
                If (baseType.BaseType Is GetType(System.[Enum])) Then
                    If (value.GetType Is destinationType) Then
                        Return value
                    End If
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return "NULL_ENUM_VALUE"
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((baseType Is GetType(Boolean)) _
                            AndAlso (baseType.BaseType Is GetType(System.ValueType))) Then
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return ""
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((Not (context) Is Nothing) _
                            AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                    Return ""
                End If
                Return baseConverter.ConvertTo(context, culture, value, destinationType)
            End Function
        End Class

        'Embedded class to represent WMI system Properties.
        <TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _
        Public Class ManagementSystemProperties

            Private PrivateLateBoundObject As System.Management.ManagementBaseObject

            Public Sub New(ByVal ManagedObject As System.Management.ManagementBaseObject)
                MyBase.New()
                PrivateLateBoundObject = ManagedObject
            End Sub

            <Browsable(True)> _
            Public ReadOnly Property GENUS() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__GENUS"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [CLASS]() As String
                Get
                    Return CType(PrivateLateBoundObject("__CLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SUPERCLASS() As String
                Get
                    Return CType(PrivateLateBoundObject("__SUPERCLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DYNASTY() As String
                Get
                    Return CType(PrivateLateBoundObject("__DYNASTY"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property RELPATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__RELPATH"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PROPERTY_COUNT() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__PROPERTY_COUNT"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DERIVATION() As String()
                Get
                    Return CType(PrivateLateBoundObject("__DERIVATION"), String())
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SERVER() As String
                Get
                    Return CType(PrivateLateBoundObject("__SERVER"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [NAMESPACE]() As String
                Get
                    Return CType(PrivateLateBoundObject("__NAMESPACE"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__PATH"), String)
                End Get
            End Property
        End Class


#End Region

    End Class ' Rfc1213_mib_interfaces


    'Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
    'Functions Is<PropertyName>Null() are used to check if a property is NULL.
    'Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
    'Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
    'An Early Bound class generated for the WMI class.snmp_rfc1213_mib_iproutetable
    Public Class Rfc1213_mib_iproutetable
        Inherits System.ComponentModel.Component





#Region "begin"


        'Private property to hold the WMI namespace in which the class resides.
        Private Shared CreatedWmiNamespace As String = "root\snmp\smir"

        'Private property to hold the name of WMI class which created this class.
        Private Shared CreatedClassName As String = "snmp_rfc1213_mib_iproutetable"

        'Private member variable to hold the ManagementScope which is used by the various methods.
        Private Shared statMgmtScope As System.Management.ManagementScope = Nothing

        Private PrivateSystemProperties As ManagementSystemProperties

        'Underlying lateBound WMI object.
        Private PrivateLateBoundObject As System.Management.ManagementObject

        'Member variable to store the 'automatic commit' behavior for the class.
        Private AutoCommitProp As Boolean

        'Private variable to hold the embedded property representing the instance.
        Private embeddedObj As System.Management.ManagementBaseObject

        'The current WMI object used
        Private curObj As System.Management.ManagementBaseObject

        'Flag to indicate if the instance is an embedded object.
        Private isEmbedded As Boolean

        'Below are different overloads of constructors to initialize an instance of the class with a WMI object.
        Public Sub New()
            MyBase.New()
            Me.InitializeObject(Nothing, Nothing, Nothing)
        End Sub

        Public Sub New(ByVal keyipRouteDest As String)
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_iproutetable.ConstructPath(keyipRouteDest)), Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal keyipRouteDest As String)
            MyBase.New()
            Me.InitializeObject(CType(mgmtScope, System.Management.ManagementScope), New System.Management.ManagementPath(Rfc1213_mib_iproutetable.ConstructPath(keyipRouteDest)), Nothing)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(Nothing, path, getOptions)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, Nothing)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(Nothing, path, Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, getOptions)
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                PrivateLateBoundObject = theObject
                PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
                curObj = PrivateLateBoundObject
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementBaseObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                embeddedObj = theObject
                PrivateSystemProperties = New ManagementSystemProperties(theObject)
                curObj = embeddedObj
                isEmbedded = True
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        'Property returns the namespace of the WMI class.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property OriginatingNamespace() As String
            Get
                Return "root\snmp\smir"
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property ManagementClassName() As String
            Get
                Dim strRet As String = CreatedClassName
                If (Not (curObj) Is Nothing) Then
                    If (Not (curObj.ClassPath) Is Nothing) Then
                        strRet = CType(curObj("__CLASS"), String)
                        If ((strRet Is Nothing) _
                                    OrElse (strRet Is String.Empty)) Then
                            strRet = CreatedClassName
                        End If
                    End If
                End If
                Return strRet
            End Get
        End Property

        'Property pointing to an embedded object to get System properties of the WMI object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property SystemProperties() As ManagementSystemProperties
            Get
                Return PrivateSystemProperties
            End Get
        End Property

        'Property returning the underlying lateBound object.
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property LateBoundObject() As System.Management.ManagementBaseObject
            Get
                Return curObj
            End Get
        End Property

        'ManagementScope of the object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property Scope() As System.Management.ManagementScope
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Scope
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                If (isEmbedded = False) Then
                    PrivateLateBoundObject.Scope = value
                End If
            End Set
        End Property

        'Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property AutoCommit() As Boolean
            Get
                Return AutoCommitProp
            End Get
            Set(ByVal value As Boolean)
                AutoCommitProp = value
            End Set
        End Property

        'The ManagementPath of the underlying WMI object.
        <Browsable(True)> _
        Public Property Path() As System.Management.ManagementPath
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Path
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementPath)
                If (isEmbedded = False) Then
                    If (CheckIfProperClass(Nothing, value, Nothing) <> True) Then
                        Throw New System.ArgumentException("Class name does not match.")
                    End If
                    PrivateLateBoundObject.Path = value
                End If
            End Set
        End Property

        'Public static scope property which is used by the various methods.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Shared Property StaticScope() As System.Management.ManagementScope
            Get
                Return statMgmtScope
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                statMgmtScope = value
            End Set
        End Property

#End Region

#Region "attributes"



        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipRouteAgeNull() As Boolean
            Get
                If (curObj("ipRouteAge") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of seconds since this route was last" & Global.Microsoft.VisualBasic.ChrW(10) & "                      updated or " & _
            "otherwise determined to be correct." & Global.Microsoft.VisualBasic.ChrW(10) & "                      Note that no semantics" & _
            " of `too old' can be implied" & Global.Microsoft.VisualBasic.ChrW(10) & "                      except through knowledge of t" & _
            "he routing protocol" & Global.Microsoft.VisualBasic.ChrW(10) & "                      by which the route was learned."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public Property ipRouteAge() As Integer
            Get
                If (curObj("ipRouteAge") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipRouteAge"), Integer)
            End Get
            Set(ByVal value As Integer)
                curObj("ipRouteAge") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The destination IP address of this route.  An" & Global.Microsoft.VisualBasic.ChrW(10) & "                      entry with a " & _
            "value of 0.0.0.0 is considered a" & Global.Microsoft.VisualBasic.ChrW(10) & "                      default route.  Multiple " & _
            "routes to a single" & Global.Microsoft.VisualBasic.ChrW(10) & "                      destination can appear in the table, bu" & _
            "t access to" & Global.Microsoft.VisualBasic.ChrW(10) & "                      such multiple entries is dependent on the tabl" & _
            "e-" & Global.Microsoft.VisualBasic.ChrW(10) & "                      access mechanisms defined by the network" & Global.Microsoft.VisualBasic.ChrW(10) & "              " & _
            "        management protocol in use.")> _
        Public ReadOnly Property ipRouteDest() As String
            Get
                Return CType(curObj("ipRouteDest"), String)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipRouteIfIndexNull() As Boolean
            Get
                If (curObj("ipRouteIfIndex") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The index value which uniquely identifies the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      local interfa" & _
            "ce through which the next hop of this" & Global.Microsoft.VisualBasic.ChrW(10) & "                      route should be reac" & _
            "hed.  The interface identified" & Global.Microsoft.VisualBasic.ChrW(10) & "                      by a particular value of th" & _
            "is index is the same" & Global.Microsoft.VisualBasic.ChrW(10) & "                      interface as identified by the same v" & _
            "alue of" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ifIndex."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public Property ipRouteIfIndex() As Integer
            Get
                If (curObj("ipRouteIfIndex") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipRouteIfIndex"), Integer)
            End Get
            Set(ByVal value As Integer)
                curObj("ipRouteIfIndex") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("A reference to MIB definitions specific to the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      particular r" & _
            "outing protocol which is responsible" & Global.Microsoft.VisualBasic.ChrW(10) & "                      for this route, as de" & _
            "termined by the value" & Global.Microsoft.VisualBasic.ChrW(10) & "                      specified in the route's ipRouteProt" & _
            "o value.  If" & Global.Microsoft.VisualBasic.ChrW(10) & "                      this information is not present, its value sh" & _
            "ould" & Global.Microsoft.VisualBasic.ChrW(10) & "                      be set to the OBJECT IDENTIFIER { 0 0 }, which is" & Global.Microsoft.VisualBasic.ChrW(10) & "   " & _
            "                   a syntactically valid object identifier, and any" & Global.Microsoft.VisualBasic.ChrW(10) & "            " & _
            "          conformant implementation of ASN.1 and BER must be" & Global.Microsoft.VisualBasic.ChrW(10) & "                   " & _
            "   able to generate and recognize this value.")> _
        Public ReadOnly Property ipRouteInfo() As String
            Get
                Return CType(curObj("ipRouteInfo"), String)
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("Indicate the mask to be logical-ANDed with the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      destination " & _
            "address before being compared to the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      value in the ipRouteD" & _
            "est field.  For those systems" & Global.Microsoft.VisualBasic.ChrW(10) & "                      that do not support arbitrar" & _
            "y subnet masks, an" & Global.Microsoft.VisualBasic.ChrW(10) & "                      agent constructs the value of the ipRou" & _
            "teMask by" & Global.Microsoft.VisualBasic.ChrW(10) & "                      determining whether the value of the corresponde" & _
            "nt" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ipRouteDest field belong to a class-A, B, or C" & Global.Microsoft.VisualBasic.ChrW(10) & "        " & _
            "              network, and then using one of:" & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10) & "                           mask  " & _
            "         network" & Global.Microsoft.VisualBasic.ChrW(10) & "                           255.0.0.0      class-A" & Global.Microsoft.VisualBasic.ChrW(10) & "             " & _
            "              255.255.0.0    class-B" & Global.Microsoft.VisualBasic.ChrW(10) & "                           255.255.255.0  c" & _
            "lass-C" & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10) & "                      If the value of the ipRouteDest is 0.0.0.0 (a" & Global.Microsoft.VisualBasic.ChrW(10) & "    " & _
            "                  default route), then the mask value is also" & Global.Microsoft.VisualBasic.ChrW(10) & "                  " & _
            "    0.0.0.0.  It should be noted that all IP routing" & Global.Microsoft.VisualBasic.ChrW(10) & "                      subsy" & _
            "stems implicitly use this mechanism.")> _
        Public Property ipRouteMask() As String
            Get
                Return CType(curObj("ipRouteMask"), String)
            End Get
            Set(ByVal value As String)
                curObj("ipRouteMask") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipRouteMetric1Null() As Boolean
            Get
                If (curObj("ipRouteMetric1") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The primary routing metric for this route.  The" & Global.Microsoft.VisualBasic.ChrW(10) & "                      semantics o" & _
            "f this metric are determined by the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      routing-protocol speci" & _
            "fied in the route's" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ipRouteProto value.  If this metric is" & _
            " not used," & Global.Microsoft.VisualBasic.ChrW(10) & "                      its value should be set to -1."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public Property ipRouteMetric1() As Integer
            Get
                If (curObj("ipRouteMetric1") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipRouteMetric1"), Integer)
            End Get
            Set(ByVal value As Integer)
                curObj("ipRouteMetric1") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipRouteMetric2Null() As Boolean
            Get
                If (curObj("ipRouteMetric2") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("An alternate routing metric for this route.  The" & Global.Microsoft.VisualBasic.ChrW(10) & "                      semantics " & _
            "of this metric are determined by the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      routing-protocol spec" & _
            "ified in the route's" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ipRouteProto value.  If this metric i" & _
            "s not used," & Global.Microsoft.VisualBasic.ChrW(10) & "                      its value should be set to -1."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public Property ipRouteMetric2() As Integer
            Get
                If (curObj("ipRouteMetric2") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipRouteMetric2"), Integer)
            End Get
            Set(ByVal value As Integer)
                curObj("ipRouteMetric2") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipRouteMetric3Null() As Boolean
            Get
                If (curObj("ipRouteMetric3") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("An alternate routing metric for this route.  The" & Global.Microsoft.VisualBasic.ChrW(10) & "                      semantics " & _
            "of this metric are determined by the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      routing-protocol spec" & _
            "ified in the route's" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ipRouteProto value.  If this metric i" & _
            "s not used," & Global.Microsoft.VisualBasic.ChrW(10) & "                      its value should be set to -1."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public Property ipRouteMetric3() As Integer
            Get
                If (curObj("ipRouteMetric3") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipRouteMetric3"), Integer)
            End Get
            Set(ByVal value As Integer)
                curObj("ipRouteMetric3") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipRouteMetric4Null() As Boolean
            Get
                If (curObj("ipRouteMetric4") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("An alternate routing metric for this route.  The" & Global.Microsoft.VisualBasic.ChrW(10) & "                      semantics " & _
            "of this metric are determined by the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      routing-protocol spec" & _
            "ified in the route's" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ipRouteProto value.  If this metric i" & _
            "s not used," & Global.Microsoft.VisualBasic.ChrW(10) & "                      its value should be set to -1."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public Property ipRouteMetric4() As Integer
            Get
                If (curObj("ipRouteMetric4") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipRouteMetric4"), Integer)
            End Get
            Set(ByVal value As Integer)
                curObj("ipRouteMetric4") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipRouteMetric5Null() As Boolean
            Get
                If (curObj("ipRouteMetric5") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("An alternate routing metric for this route.  The" & Global.Microsoft.VisualBasic.ChrW(10) & "                      semantics " & _
            "of this metric are determined by the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      routing-protocol spec" & _
            "ified in the route's" & Global.Microsoft.VisualBasic.ChrW(10) & "                      ipRouteProto value.  If this metric i" & _
            "s not used," & Global.Microsoft.VisualBasic.ChrW(10) & "                      its value should be set to -1."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public Property ipRouteMetric5() As Integer
            Get
                If (curObj("ipRouteMetric5") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipRouteMetric5"), Integer)
            End Get
            Set(ByVal value As Integer)
                curObj("ipRouteMetric5") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The IP address of the next hop of this route." & Global.Microsoft.VisualBasic.ChrW(10) & "                      (In the case " & _
            "of a route bound to an interface" & Global.Microsoft.VisualBasic.ChrW(10) & "                      which is realized via a b" & _
            "roadcast media, the value" & Global.Microsoft.VisualBasic.ChrW(10) & "                      of this field is the agent's IP " & _
            "address on that" & Global.Microsoft.VisualBasic.ChrW(10) & "                      interface.)")> _
        Public Property ipRouteNextHop() As String
            Get
                Return CType(curObj("ipRouteNextHop"), String)
            End Get
            Set(ByVal value As String)
                curObj("ipRouteNextHop") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The routing mechanism via which this route was" & Global.Microsoft.VisualBasic.ChrW(10) & "                      learned.  In" & _
            "clusion of values for gateway routing" & Global.Microsoft.VisualBasic.ChrW(10) & "                      protocols is not int" & _
            "ended to imply that hosts" & Global.Microsoft.VisualBasic.ChrW(10) & "                      should support those protocols.")> _
        Public ReadOnly Property ipRouteProto() As String
            Get
                Return CType(curObj("ipRouteProto"), String)
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The type of route.  Note that the values" & Global.Microsoft.VisualBasic.ChrW(10) & "                      direct(3) and indi" & _
            "rect(4) refer to the notion of" & Global.Microsoft.VisualBasic.ChrW(10) & "                      direct and indirect routing" & _
            " in the IP" & Global.Microsoft.VisualBasic.ChrW(10) & "                      architecture." & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10) & "                      Setting th" & _
            "is object to the value invalid(2) has" & Global.Microsoft.VisualBasic.ChrW(10) & "                      the effect of invali" & _
            "dating the corresponding entry" & Global.Microsoft.VisualBasic.ChrW(10) & "                      in the ipRouteTable object." & _
            "  That is, it" & Global.Microsoft.VisualBasic.ChrW(10) & "                      effectively disassociates the destination" & Global.Microsoft.VisualBasic.ChrW(10) & "  " & _
            "                    identified with said entry from the route" & Global.Microsoft.VisualBasic.ChrW(10) & "                  " & _
            "    identified with said entry.  It is an" & Global.Microsoft.VisualBasic.ChrW(10) & "                      implementation-s" & _
            "pecific matter as to whether the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      agent removes an invalida" & _
            "ted entry from the table." & Global.Microsoft.VisualBasic.ChrW(10) & "                      Accordingly, management stations" & _
            " must be prepared" & Global.Microsoft.VisualBasic.ChrW(10) & "                      to receive tabular information from agen" & _
            "ts that" & Global.Microsoft.VisualBasic.ChrW(10) & "                      corresponds to entries not currently in use." & Global.Microsoft.VisualBasic.ChrW(10) & "     " & _
            "                 Proper interpretation of such entries requires" & Global.Microsoft.VisualBasic.ChrW(10) & "                " & _
            "      examination of the relevant ipRouteType object.")> _
        Public Property ipRouteType() As String
            Get
                Return CType(curObj("ipRouteType"), String)
            End Get
            Set(ByVal value As String)
                curObj("ipRouteType") = value
                If ((isEmbedded = False) _
                            AndAlso (AutoCommitProp = True)) Then
                    PrivateLateBoundObject.Put()
                End If
            End Set
        End Property

#End Region

#Region "the rest"


        Private Overloads Function CheckIfProperClass(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal OptionsParam As System.Management.ObjectGetOptions) As Boolean
            If ((Not (path) Is Nothing) _
                        AndAlso (String.Compare(path.ClassName, Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Return CheckIfProperClass(New System.Management.ManagementObject(mgmtScope, path, OptionsParam))
            End If
        End Function

        Private Overloads Function CheckIfProperClass(ByVal theObj As System.Management.ManagementBaseObject) As Boolean
            If ((Not (theObj) Is Nothing) _
                        AndAlso (String.Compare(CType(theObj("__CLASS"), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Dim parentClasses As System.Array = CType(theObj("__DERIVATION"), System.Array)
                If (Not (parentClasses) Is Nothing) Then
                    Dim count As Integer = 0
                    count = 0
                    Do While (count < parentClasses.Length)
                        If (String.Compare(CType(parentClasses.GetValue(count), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0) Then
                            Return True
                        End If
                        count = (count + 1)
                    Loop
                End If
            End If
            Return False
        End Function

        Private Function ShouldSerializeipRouteAge() As Boolean
            If (Me.IsipRouteAgeNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Sub ResetipRouteAge()
            curObj("ipRouteAge") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Function ShouldSerializeipRouteIfIndex() As Boolean
            If (Me.IsipRouteIfIndexNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Sub ResetipRouteIfIndex()
            curObj("ipRouteIfIndex") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Sub ResetipRouteMask()
            curObj("ipRouteMask") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Function ShouldSerializeipRouteMetric1() As Boolean
            If (Me.IsipRouteMetric1Null = False) Then
                Return True
            End If
            Return False
        End Function

        Private Sub ResetipRouteMetric1()
            curObj("ipRouteMetric1") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Function ShouldSerializeipRouteMetric2() As Boolean
            If (Me.IsipRouteMetric2Null = False) Then
                Return True
            End If
            Return False
        End Function

        Private Sub ResetipRouteMetric2()
            curObj("ipRouteMetric2") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Function ShouldSerializeipRouteMetric3() As Boolean
            If (Me.IsipRouteMetric3Null = False) Then
                Return True
            End If
            Return False
        End Function

        Private Sub ResetipRouteMetric3()
            curObj("ipRouteMetric3") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Function ShouldSerializeipRouteMetric4() As Boolean
            If (Me.IsipRouteMetric4Null = False) Then
                Return True
            End If
            Return False
        End Function

        Private Sub ResetipRouteMetric4()
            curObj("ipRouteMetric4") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Function ShouldSerializeipRouteMetric5() As Boolean
            If (Me.IsipRouteMetric5Null = False) Then
                Return True
            End If
            Return False
        End Function

        Private Sub ResetipRouteMetric5()
            curObj("ipRouteMetric5") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Sub ResetipRouteNextHop()
            curObj("ipRouteNextHop") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        Private Sub ResetipRouteType()
            curObj("ipRouteType") = Nothing
            If ((isEmbedded = False) _
                        AndAlso (AutoCommitProp = True)) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        <Browsable(True)> _
        Public Overloads Sub CommitObject()
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        <Browsable(True)> _
        Public Overloads Sub CommitObject(ByVal putOptions As System.Management.PutOptions)
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put(putOptions)
            End If
        End Sub

        Private Sub Initialize()
            AutoCommitProp = True
            isEmbedded = False
        End Sub

        Private Shared Function ConstructPath(ByVal keyipRouteDest As String) As String
            Dim strPath As String = "root\snmp\smir:snmp_rfc1213_mib_iproutetable"
            strPath = String.Concat(strPath, String.Concat(".ipRouteDest=", String.Concat("""", String.Concat(keyipRouteDest, """"))))
            Return strPath
        End Function

        Private Sub InitializeObject(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            Initialize()
            If (Not (path) Is Nothing) Then
                If (CheckIfProperClass(mgmtScope, path, getOptions) <> True) Then
                    Throw New System.ArgumentException("Class name does not match.")
                End If
            End If
            PrivateLateBoundObject = New System.Management.ManagementObject(mgmtScope, path, getOptions)
            PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
            curObj = PrivateLateBoundObject
        End Sub

        'Different overloads of GetInstances() help in enumerating instances of the WMI class.
        Public Overloads Shared Function GetInstances() As Rfc1213_mib_iproutetableCollection
            Return GetInstances(Nothing, Nothing, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal condition As String) As Rfc1213_mib_iproutetableCollection
            Return GetInstances(Nothing, condition, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal selectedProperties() As System.String) As Rfc1213_mib_iproutetableCollection
            Return GetInstances(Nothing, Nothing, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal condition As String, ByVal selectedProperties() As System.String) As Rfc1213_mib_iproutetableCollection
            Return GetInstances(Nothing, condition, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal enumOptions As System.Management.EnumerationOptions) As Rfc1213_mib_iproutetableCollection
            If (mgmtScope Is Nothing) Then
                If (statMgmtScope Is Nothing) Then
                    mgmtScope = New System.Management.ManagementScope
                    mgmtScope.Path.NamespacePath = "root\snmp\smir"
                Else
                    mgmtScope = statMgmtScope
                End If
            End If
            Dim pathObj As System.Management.ManagementPath = New System.Management.ManagementPath
            pathObj.ClassName = "snmp_rfc1213_mib_iproutetable"
            pathObj.NamespacePath = "root\snmp\smir"
            Dim clsObject As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, pathObj, Nothing)
            If (enumOptions Is Nothing) Then
                enumOptions = New System.Management.EnumerationOptions
                enumOptions.EnsureLocatable = True
            End If
            Return New Rfc1213_mib_iproutetableCollection(clsObject.GetInstances(enumOptions))
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal condition As String) As Rfc1213_mib_iproutetableCollection
            Return GetInstances(mgmtScope, condition, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal selectedProperties() As System.String) As Rfc1213_mib_iproutetableCollection
            Return GetInstances(mgmtScope, Nothing, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal condition As String, ByVal selectedProperties() As System.String) As Rfc1213_mib_iproutetableCollection
            If (mgmtScope Is Nothing) Then
                If (statMgmtScope Is Nothing) Then
                    mgmtScope = New System.Management.ManagementScope
                    mgmtScope.Path.NamespacePath = "root\snmp\smir"
                Else
                    mgmtScope = statMgmtScope
                End If
            End If
            Dim ObjectSearcher As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher(mgmtScope, New SelectQuery("snmp_rfc1213_mib_iproutetable", condition, selectedProperties))
            Dim enumOptions As System.Management.EnumerationOptions = New System.Management.EnumerationOptions
            enumOptions.EnsureLocatable = True
            ObjectSearcher.Options = enumOptions
            Return New Rfc1213_mib_iproutetableCollection(ObjectSearcher.Get)
        End Function

        <Browsable(True)> _
        Public Shared Function CreateInstance() As Rfc1213_mib_iproutetable
            Dim mgmtScope As System.Management.ManagementScope = Nothing
            If (statMgmtScope Is Nothing) Then
                mgmtScope = New System.Management.ManagementScope
                mgmtScope.Path.NamespacePath = CreatedWmiNamespace
            Else
                mgmtScope = statMgmtScope
            End If
            Dim mgmtPath As System.Management.ManagementPath = New System.Management.ManagementPath(CreatedClassName)
            Dim tmpMgmtClass As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, mgmtPath, Nothing)
            Return New Rfc1213_mib_iproutetable(tmpMgmtClass.CreateInstance)
        End Function

        <Browsable(True)> _
        Public Sub Delete()
            PrivateLateBoundObject.Delete()
        End Sub

        'Enumerator implementation for enumerating instances of the class.
        Public Class Rfc1213_mib_iproutetableCollection
            Inherits Object
            Implements ICollection

            Private privColObj As ManagementObjectCollection

            Public Sub New(ByVal objCollection As ManagementObjectCollection)
                MyBase.New()
                privColObj = objCollection
            End Sub

            Public Overridable ReadOnly Property Count() As Integer Implements System.Collections.ICollection.Count
                Get
                    Return privColObj.Count
                End Get
            End Property

            Public Overridable ReadOnly Property IsSynchronized() As Boolean Implements System.Collections.ICollection.IsSynchronized
                Get
                    Return privColObj.IsSynchronized
                End Get
            End Property

            Public Overridable ReadOnly Property SyncRoot() As Object Implements System.Collections.ICollection.SyncRoot
                Get
                    Return Me
                End Get
            End Property

            Public Overridable Sub CopyTo(ByVal array As System.Array, ByVal index As Integer) Implements System.Collections.ICollection.CopyTo
                privColObj.CopyTo(array, index)
                Dim nCtr As Integer
                nCtr = 0
                Do While (nCtr < array.Length)
                    array.SetValue(New Rfc1213_mib_iproutetable(CType(array.GetValue(nCtr), System.Management.ManagementObject)), nCtr)
                    nCtr = (nCtr + 1)
                Loop
            End Sub

            Public Overridable Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
                Return New Rfc1213_mib_iproutetableEnumerator(privColObj.GetEnumerator)
            End Function

            Public Class Rfc1213_mib_iproutetableEnumerator
                Inherits Object
                Implements System.Collections.IEnumerator

                Private privObjEnum As ManagementObjectCollection.ManagementObjectEnumerator

                Public Sub New(ByVal objEnum As ManagementObjectCollection.ManagementObjectEnumerator)
                    MyBase.New()
                    privObjEnum = objEnum
                End Sub

                Public Overridable ReadOnly Property Current() As Object Implements System.Collections.IEnumerator.Current
                    Get
                        Return New Rfc1213_mib_iproutetable(CType(privObjEnum.Current, System.Management.ManagementObject))
                    End Get
                End Property

                Public Overridable Function MoveNext() As Boolean Implements System.Collections.IEnumerator.MoveNext
                    Return privObjEnum.MoveNext
                End Function

                Public Overridable Sub Reset() Implements System.Collections.IEnumerator.Reset
                    privObjEnum.Reset()
                End Sub
            End Class
        End Class

        'TypeConverter to handle null values for ValueType properties
        Public Class WMIValueTypeConverter
            Inherits TypeConverter

            Private baseConverter As TypeConverter

            Private baseType As System.Type

            Public Sub New(ByVal inBaseType As System.Type)
                MyBase.New()
                baseConverter = TypeDescriptor.GetConverter(inBaseType)
                baseType = inBaseType
            End Sub

            Public Overloads Overrides Function CanConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal srcType As System.Type) As Boolean
                Return baseConverter.CanConvertFrom(context, srcType)
            End Function

            Public Overloads Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As System.Type) As Boolean
                Return baseConverter.CanConvertTo(context, destinationType)
            End Function

            Public Overloads Overrides Function ConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
                Return baseConverter.ConvertFrom(context, culture, value)
            End Function

            Public Overloads Overrides Function CreateInstance(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal dictionary As System.Collections.IDictionary) As Object
                Return baseConverter.CreateInstance(context, dictionary)
            End Function

            Public Overloads Overrides Function GetCreateInstanceSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetCreateInstanceSupported(context)
            End Function

            Public Overloads Overrides Function GetProperties(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal value As Object, ByVal attributeVar() As System.Attribute) As PropertyDescriptorCollection
                Return baseConverter.GetProperties(context, value, attributeVar)
            End Function

            Public Overloads Overrides Function GetPropertiesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetPropertiesSupported(context)
            End Function

            Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
                Return baseConverter.GetStandardValues(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesExclusive(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesSupported(context)
            End Function

            Public Overloads Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
                If (baseType.BaseType Is GetType(System.[Enum])) Then
                    If (value.GetType Is destinationType) Then
                        Return value
                    End If
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return "NULL_ENUM_VALUE"
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((baseType Is GetType(Boolean)) _
                            AndAlso (baseType.BaseType Is GetType(System.ValueType))) Then
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return ""
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((Not (context) Is Nothing) _
                            AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                    Return ""
                End If
                Return baseConverter.ConvertTo(context, culture, value, destinationType)
            End Function
        End Class

        'Embedded class to represent WMI system Properties.
        <TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _
        Public Class ManagementSystemProperties

            Private PrivateLateBoundObject As System.Management.ManagementBaseObject

            Public Sub New(ByVal ManagedObject As System.Management.ManagementBaseObject)
                MyBase.New()
                PrivateLateBoundObject = ManagedObject
            End Sub

            <Browsable(True)> _
            Public ReadOnly Property GENUS() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__GENUS"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [CLASS]() As String
                Get
                    Return CType(PrivateLateBoundObject("__CLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SUPERCLASS() As String
                Get
                    Return CType(PrivateLateBoundObject("__SUPERCLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DYNASTY() As String
                Get
                    Return CType(PrivateLateBoundObject("__DYNASTY"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property RELPATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__RELPATH"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PROPERTY_COUNT() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__PROPERTY_COUNT"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DERIVATION() As String()
                Get
                    Return CType(PrivateLateBoundObject("__DERIVATION"), String())
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SERVER() As String
                Get
                    Return CType(PrivateLateBoundObject("__SERVER"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [NAMESPACE]() As String
                Get
                    Return CType(PrivateLateBoundObject("__NAMESPACE"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__PATH"), String)
                End Get
            End Property
        End Class
#End Region

    End Class ' Rfc1213_mib_iproutetable


    'Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
    'Functions Is<PropertyName>Null() are used to check if a property is NULL.
    'Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
    'Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
    'An Early Bound class generated for the WMI class.snmp_rfc1213_mib_icmp
    Public Class Rfc1213_mib_icmp
        Inherits System.ComponentModel.Component







#Region "create new stuff"

        'Private property to hold the WMI namespace in which the class resides.
        Private Shared CreatedWmiNamespace As String = "root\snmp\smir"

        'Private property to hold the name of WMI class which created this class.
        Private Shared CreatedClassName As String = "snmp_rfc1213_mib_icmp"

        'Private member variable to hold the ManagementScope which is used by the various methods.
        Private Shared statMgmtScope As System.Management.ManagementScope = Nothing

        Private PrivateSystemProperties As ManagementSystemProperties

        'Underlying lateBound WMI object.
        Private PrivateLateBoundObject As System.Management.ManagementObject

        'Member variable to store the 'automatic commit' behavior for the class.
        Private AutoCommitProp As Boolean

        'Private variable to hold the embedded property representing the instance.
        Private embeddedObj As System.Management.ManagementBaseObject

        'The current WMI object used
        Private curObj As System.Management.ManagementBaseObject

        'Flag to indicate if the instance is an embedded object.
        Private isEmbedded As Boolean

        'Below are different overloads of constructors to initialize an instance of the class with a WMI object.
        Public Sub New()
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_icmp.ConstructPath), Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope)
            MyBase.New()
            Me.InitializeObject(mgmtScope, New System.Management.ManagementPath(Rfc1213_mib_icmp.ConstructPath), Nothing)
        End Sub

        Public Sub New(ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_icmp.ConstructPath), getOptions)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, New System.Management.ManagementPath(Rfc1213_mib_icmp.ConstructPath), getOptions)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(Nothing, path, Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, getOptions)
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                PrivateLateBoundObject = theObject
                PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
                curObj = PrivateLateBoundObject
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementBaseObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                embeddedObj = theObject
                PrivateSystemProperties = New ManagementSystemProperties(theObject)
                curObj = embeddedObj
                isEmbedded = True
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        'Property returns the namespace of the WMI class.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property OriginatingNamespace() As String
            Get
                Return "root\snmp\smir"
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property ManagementClassName() As String
            Get
                Dim strRet As String = CreatedClassName
                If (Not (curObj) Is Nothing) Then
                    If (Not (curObj.ClassPath) Is Nothing) Then
                        strRet = CType(curObj("__CLASS"), String)
                        If ((strRet Is Nothing) _
                                    OrElse (strRet Is String.Empty)) Then
                            strRet = CreatedClassName
                        End If
                    End If
                End If
                Return strRet
            End Get
        End Property

        'Property pointing to an embedded object to get System properties of the WMI object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property SystemProperties() As ManagementSystemProperties
            Get
                Return PrivateSystemProperties
            End Get
        End Property

        'Property returning the underlying lateBound object.
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property LateBoundObject() As System.Management.ManagementBaseObject
            Get
                Return curObj
            End Get
        End Property

        'ManagementScope of the object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property Scope() As System.Management.ManagementScope
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Scope
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                If (isEmbedded = False) Then
                    PrivateLateBoundObject.Scope = value
                End If
            End Set
        End Property

        'Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property AutoCommit() As Boolean
            Get
                Return AutoCommitProp
            End Get
            Set(ByVal value As Boolean)
                AutoCommitProp = value
            End Set
        End Property

        'The ManagementPath of the underlying WMI object.
        <Browsable(True)> _
        Public Property Path() As System.Management.ManagementPath
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Path
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementPath)
                If (isEmbedded = False) Then
                    If (CheckIfProperClass(Nothing, value, Nothing) <> True) Then
                        Throw New System.ArgumentException("Class name does not match.")
                    End If
                    PrivateLateBoundObject.Path = value
                End If
            End Set
        End Property

        'Public static scope property which is used by the various methods.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Shared Property StaticScope() As System.Management.ManagementScope
            Get
                Return statMgmtScope
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                statMgmtScope = value
            End Set
        End Property

#End Region

#Region "attributes"



        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInAddrMaskRepsNull() As Boolean
            Get
                If (curObj("icmpInAddrMaskReps") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Address Mask Reply messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInAddrMaskReps() As UInteger
            Get
                If (curObj("icmpInAddrMaskReps") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInAddrMaskReps"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInAddrMasksNull() As Boolean
            Get
                If (curObj("icmpInAddrMasks") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Address Mask Request messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInAddrMasks() As UInteger
            Get
                If (curObj("icmpInAddrMasks") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInAddrMasks"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInDestUnreachsNull() As Boolean
            Get
                If (curObj("icmpInDestUnreachs") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Destination Unreachable" & Global.Microsoft.VisualBasic.ChrW(10) & "                      messages receive" & _
            "d."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInDestUnreachs() As UInteger
            Get
                If (curObj("icmpInDestUnreachs") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInDestUnreachs"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInEchoRepsNull() As Boolean
            Get
                If (curObj("icmpInEchoReps") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Echo Reply messages received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInEchoReps() As UInteger
            Get
                If (curObj("icmpInEchoReps") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInEchoReps"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInEchosNull() As Boolean
            Get
                If (curObj("icmpInEchos") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Echo (request) messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInEchos() As UInteger
            Get
                If (curObj("icmpInEchos") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInEchos"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInErrorsNull() As Boolean
            Get
                If (curObj("icmpInErrors") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP messages which the entity" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received but d" & _
            "etermined as having ICMP-specific" & Global.Microsoft.VisualBasic.ChrW(10) & "                      errors (bad ICMP checksu" & _
            "ms, bad length, etc.)."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInErrors() As UInteger
            Get
                If (curObj("icmpInErrors") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInErrors"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInMsgsNull() As Boolean
            Get
                If (curObj("icmpInMsgs") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The total number of ICMP messages which the" & Global.Microsoft.VisualBasic.ChrW(10) & "                      entity received" & _
            ".  Note that this counter includes" & Global.Microsoft.VisualBasic.ChrW(10) & "                      all those counted by ic" & _
            "mpInErrors."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInMsgs() As UInteger
            Get
                If (curObj("icmpInMsgs") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInMsgs"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInParmProbsNull() As Boolean
            Get
                If (curObj("icmpInParmProbs") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Parameter Problem messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInParmProbs() As UInteger
            Get
                If (curObj("icmpInParmProbs") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInParmProbs"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInRedirectsNull() As Boolean
            Get
                If (curObj("icmpInRedirects") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Redirect messages received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInRedirects() As UInteger
            Get
                If (curObj("icmpInRedirects") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInRedirects"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInSrcQuenchsNull() As Boolean
            Get
                If (curObj("icmpInSrcQuenchs") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Source Quench messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInSrcQuenchs() As UInteger
            Get
                If (curObj("icmpInSrcQuenchs") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInSrcQuenchs"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInTimeExcdsNull() As Boolean
            Get
                If (curObj("icmpInTimeExcds") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Time Exceeded messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInTimeExcds() As UInteger
            Get
                If (curObj("icmpInTimeExcds") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInTimeExcds"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInTimestampRepsNull() As Boolean
            Get
                If (curObj("icmpInTimestampReps") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Timestamp Reply messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInTimestampReps() As UInteger
            Get
                If (curObj("icmpInTimestampReps") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInTimestampReps"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpInTimestampsNull() As Boolean
            Get
                If (curObj("icmpInTimestamps") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Timestamp (request) messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      received."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpInTimestamps() As UInteger
            Get
                If (curObj("icmpInTimestamps") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpInTimestamps"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutAddrMaskRepsNull() As Boolean
            Get
                If (curObj("icmpOutAddrMaskReps") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Address Mask Reply messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutAddrMaskReps() As UInteger
            Get
                If (curObj("icmpOutAddrMaskReps") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutAddrMaskReps"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutAddrMasksNull() As Boolean
            Get
                If (curObj("icmpOutAddrMasks") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Address Mask Request messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutAddrMasks() As UInteger
            Get
                If (curObj("icmpOutAddrMasks") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutAddrMasks"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutDestUnreachsNull() As Boolean
            Get
                If (curObj("icmpOutDestUnreachs") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Destination Unreachable" & Global.Microsoft.VisualBasic.ChrW(10) & "                      messages sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutDestUnreachs() As UInteger
            Get
                If (curObj("icmpOutDestUnreachs") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutDestUnreachs"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutEchoRepsNull() As Boolean
            Get
                If (curObj("icmpOutEchoReps") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Echo Reply messages sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutEchoReps() As UInteger
            Get
                If (curObj("icmpOutEchoReps") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutEchoReps"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutEchosNull() As Boolean
            Get
                If (curObj("icmpOutEchos") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Echo (request) messages sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutEchos() As UInteger
            Get
                If (curObj("icmpOutEchos") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutEchos"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutErrorsNull() As Boolean
            Get
                If (curObj("icmpOutErrors") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP messages which this entity did" & Global.Microsoft.VisualBasic.ChrW(10) & "                      not send " & _
            "due to problems discovered within ICMP" & Global.Microsoft.VisualBasic.ChrW(10) & "                      such as a lack of b" & _
            "uffers.  This value should not" & Global.Microsoft.VisualBasic.ChrW(10) & "                      include errors discovered o" & _
            "utside the ICMP layer" & Global.Microsoft.VisualBasic.ChrW(10) & "                      such as the inability of IP to route" & _
            " the resultant" & Global.Microsoft.VisualBasic.ChrW(10) & "                      datagram.  In some implementations there ma" & _
            "y be no" & Global.Microsoft.VisualBasic.ChrW(10) & "                      types of error which contribute to this counter's" & Global.Microsoft.VisualBasic.ChrW(10) & _
            "                      value."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutErrors() As UInteger
            Get
                If (curObj("icmpOutErrors") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutErrors"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutMsgsNull() As Boolean
            Get
                If (curObj("icmpOutMsgs") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The total number of ICMP messages which this" & Global.Microsoft.VisualBasic.ChrW(10) & "                      entity attempt" & _
            "ed to send.  Note that this counter" & Global.Microsoft.VisualBasic.ChrW(10) & "                      includes all those cou" & _
            "nted by icmpOutErrors."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutMsgs() As UInteger
            Get
                If (curObj("icmpOutMsgs") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutMsgs"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutParmProbsNull() As Boolean
            Get
                If (curObj("icmpOutParmProbs") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Parameter Problem messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutParmProbs() As UInteger
            Get
                If (curObj("icmpOutParmProbs") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutParmProbs"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutRedirectsNull() As Boolean
            Get
                If (curObj("icmpOutRedirects") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Redirect messages sent.  For a" & Global.Microsoft.VisualBasic.ChrW(10) & "                      host, thi" & _
            "s object will always be zero, since hosts" & Global.Microsoft.VisualBasic.ChrW(10) & "                      do not send redi" & _
            "rects."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutRedirects() As UInteger
            Get
                If (curObj("icmpOutRedirects") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutRedirects"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutSrcQuenchsNull() As Boolean
            Get
                If (curObj("icmpOutSrcQuenchs") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Source Quench messages sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutSrcQuenchs() As UInteger
            Get
                If (curObj("icmpOutSrcQuenchs") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutSrcQuenchs"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutTimeExcdsNull() As Boolean
            Get
                If (curObj("icmpOutTimeExcds") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Time Exceeded messages sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutTimeExcds() As UInteger
            Get
                If (curObj("icmpOutTimeExcds") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutTimeExcds"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutTimestampRepsNull() As Boolean
            Get
                If (curObj("icmpOutTimestampReps") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Timestamp Reply messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutTimestampReps() As UInteger
            Get
                If (curObj("icmpOutTimestampReps") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutTimestampReps"), UInteger)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsicmpOutTimestampsNull() As Boolean
            Get
                If (curObj("icmpOutTimestamps") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         Description("The number of ICMP Timestamp (request) messages" & Global.Microsoft.VisualBasic.ChrW(10) & "                      sent."), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property icmpOutTimestamps() As UInteger
            Get
                If (curObj("icmpOutTimestamps") Is Nothing) Then
                    Return System.Convert.ToUInt32(0)
                End If
                Return CType(curObj("icmpOutTimestamps"), UInteger)
            End Get
        End Property

#End Region

#Region "the rest"

        Private Overloads Function CheckIfProperClass(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal OptionsParam As System.Management.ObjectGetOptions) As Boolean
            If ((Not (path) Is Nothing) _
                        AndAlso (String.Compare(path.ClassName, Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Return CheckIfProperClass(New System.Management.ManagementObject(mgmtScope, path, OptionsParam))
            End If
        End Function

        Private Overloads Function CheckIfProperClass(ByVal theObj As System.Management.ManagementBaseObject) As Boolean
            If ((Not (theObj) Is Nothing) _
                        AndAlso (String.Compare(CType(theObj("__CLASS"), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Dim parentClasses As System.Array = CType(theObj("__DERIVATION"), System.Array)
                If (Not (parentClasses) Is Nothing) Then
                    Dim count As Integer = 0
                    count = 0
                    Do While (count < parentClasses.Length)
                        If (String.Compare(CType(parentClasses.GetValue(count), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0) Then
                            Return True
                        End If
                        count = (count + 1)
                    Loop
                End If
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInAddrMaskReps() As Boolean
            If (Me.IsicmpInAddrMaskRepsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInAddrMasks() As Boolean
            If (Me.IsicmpInAddrMasksNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInDestUnreachs() As Boolean
            If (Me.IsicmpInDestUnreachsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInEchoReps() As Boolean
            If (Me.IsicmpInEchoRepsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInEchos() As Boolean
            If (Me.IsicmpInEchosNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInErrors() As Boolean
            If (Me.IsicmpInErrorsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInMsgs() As Boolean
            If (Me.IsicmpInMsgsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInParmProbs() As Boolean
            If (Me.IsicmpInParmProbsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInRedirects() As Boolean
            If (Me.IsicmpInRedirectsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInSrcQuenchs() As Boolean
            If (Me.IsicmpInSrcQuenchsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInTimeExcds() As Boolean
            If (Me.IsicmpInTimeExcdsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInTimestampReps() As Boolean
            If (Me.IsicmpInTimestampRepsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpInTimestamps() As Boolean
            If (Me.IsicmpInTimestampsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutAddrMaskReps() As Boolean
            If (Me.IsicmpOutAddrMaskRepsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutAddrMasks() As Boolean
            If (Me.IsicmpOutAddrMasksNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutDestUnreachs() As Boolean
            If (Me.IsicmpOutDestUnreachsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutEchoReps() As Boolean
            If (Me.IsicmpOutEchoRepsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutEchos() As Boolean
            If (Me.IsicmpOutEchosNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutErrors() As Boolean
            If (Me.IsicmpOutErrorsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutMsgs() As Boolean
            If (Me.IsicmpOutMsgsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutParmProbs() As Boolean
            If (Me.IsicmpOutParmProbsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutRedirects() As Boolean
            If (Me.IsicmpOutRedirectsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutSrcQuenchs() As Boolean
            If (Me.IsicmpOutSrcQuenchsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutTimeExcds() As Boolean
            If (Me.IsicmpOutTimeExcdsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutTimestampReps() As Boolean
            If (Me.IsicmpOutTimestampRepsNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeicmpOutTimestamps() As Boolean
            If (Me.IsicmpOutTimestampsNull = False) Then
                Return True
            End If
            Return False
        End Function

        <Browsable(True)> _
        Public Overloads Sub CommitObject()
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        <Browsable(True)> _
        Public Overloads Sub CommitObject(ByVal putOptions As System.Management.PutOptions)
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put(putOptions)
            End If
        End Sub

        Private Sub Initialize()
            AutoCommitProp = True
            isEmbedded = False
        End Sub

        Private Shared Function ConstructPath() As String
            Return "root\snmp\smir:snmp_rfc1213_mib_icmp=@"
        End Function

        Private Sub InitializeObject(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            Initialize()
            If (Not (path) Is Nothing) Then
                If (CheckIfProperClass(mgmtScope, path, getOptions) <> True) Then
                    Throw New System.ArgumentException("Class name does not match.")
                End If
            End If
            PrivateLateBoundObject = New System.Management.ManagementObject(mgmtScope, path, getOptions)
            PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
            curObj = PrivateLateBoundObject
        End Sub

        <Browsable(True)> _
        Public Shared Function CreateInstance() As Rfc1213_mib_icmp
            Dim mgmtScope As System.Management.ManagementScope = Nothing
            If (statMgmtScope Is Nothing) Then
                mgmtScope = New System.Management.ManagementScope
                mgmtScope.Path.NamespacePath = CreatedWmiNamespace
            Else
                mgmtScope = statMgmtScope
            End If
            Dim mgmtPath As System.Management.ManagementPath = New System.Management.ManagementPath(CreatedClassName)
            Dim tmpMgmtClass As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, mgmtPath, Nothing)
            Return New Rfc1213_mib_icmp(tmpMgmtClass.CreateInstance)
        End Function

        <Browsable(True)> _
        Public Sub Delete()
            PrivateLateBoundObject.Delete()
        End Sub

        'TypeConverter to handle null values for ValueType properties
        Public Class WMIValueTypeConverter
            Inherits TypeConverter

            Private baseConverter As TypeConverter

            Private baseType As System.Type

            Public Sub New(ByVal inBaseType As System.Type)
                MyBase.New()
                baseConverter = TypeDescriptor.GetConverter(inBaseType)
                baseType = inBaseType
            End Sub

            Public Overloads Overrides Function CanConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal srcType As System.Type) As Boolean
                Return baseConverter.CanConvertFrom(context, srcType)
            End Function

            Public Overloads Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As System.Type) As Boolean
                Return baseConverter.CanConvertTo(context, destinationType)
            End Function

            Public Overloads Overrides Function ConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
                Return baseConverter.ConvertFrom(context, culture, value)
            End Function

            Public Overloads Overrides Function CreateInstance(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal dictionary As System.Collections.IDictionary) As Object
                Return baseConverter.CreateInstance(context, dictionary)
            End Function

            Public Overloads Overrides Function GetCreateInstanceSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetCreateInstanceSupported(context)
            End Function

            Public Overloads Overrides Function GetProperties(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal value As Object, ByVal attributeVar() As System.Attribute) As PropertyDescriptorCollection
                Return baseConverter.GetProperties(context, value, attributeVar)
            End Function

            Public Overloads Overrides Function GetPropertiesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetPropertiesSupported(context)
            End Function

            Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
                Return baseConverter.GetStandardValues(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesExclusive(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesSupported(context)
            End Function

            Public Overloads Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
                If (baseType.BaseType Is GetType(System.[Enum])) Then
                    If (value.GetType Is destinationType) Then
                        Return value
                    End If
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return "NULL_ENUM_VALUE"
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((baseType Is GetType(Boolean)) _
                            AndAlso (baseType.BaseType Is GetType(System.ValueType))) Then
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return ""
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((Not (context) Is Nothing) _
                            AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                    Return ""
                End If
                Return baseConverter.ConvertTo(context, culture, value, destinationType)
            End Function
        End Class

        'Embedded class to represent WMI system Properties.
        <TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _
        Public Class ManagementSystemProperties

            Private PrivateLateBoundObject As System.Management.ManagementBaseObject

            Public Sub New(ByVal ManagedObject As System.Management.ManagementBaseObject)
                MyBase.New()
                PrivateLateBoundObject = ManagedObject
            End Sub

            <Browsable(True)> _
            Public ReadOnly Property GENUS() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__GENUS"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [CLASS]() As String
                Get
                    Return CType(PrivateLateBoundObject("__CLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SUPERCLASS() As String
                Get
                    Return CType(PrivateLateBoundObject("__SUPERCLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DYNASTY() As String
                Get
                    Return CType(PrivateLateBoundObject("__DYNASTY"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property RELPATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__RELPATH"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PROPERTY_COUNT() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__PROPERTY_COUNT"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DERIVATION() As String()
                Get
                    Return CType(PrivateLateBoundObject("__DERIVATION"), String())
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SERVER() As String
                Get
                    Return CType(PrivateLateBoundObject("__SERVER"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [NAMESPACE]() As String
                Get
                    Return CType(PrivateLateBoundObject("__NAMESPACE"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__PATH"), String)
                End Get
            End Property
        End Class

#End Region

    End Class ' Rfc1213_mib_icmp


    'Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio.
    'Functions Is<PropertyName>Null() are used to check if a property is NULL.
    'Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL.
    'Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used.
    'An Early Bound class generated for the WMI class.snmp_rfc1213_mib_ipaddrtable
    Public Class Rfc1213_mib_ipaddrtable
        Inherits System.ComponentModel.Component

#Region "begin"
        'Private property to hold the WMI namespace in which the class resides.
        Private Shared CreatedWmiNamespace As String = "root\snmp\smir"

        'Private property to hold the name of WMI class which created this class.
        Private Shared CreatedClassName As String = "snmp_rfc1213_mib_ipaddrtable"

        'Private member variable to hold the ManagementScope which is used by the various methods.
        Private Shared statMgmtScope As System.Management.ManagementScope = Nothing

        Private PrivateSystemProperties As ManagementSystemProperties

        'Underlying lateBound WMI object.
        Private PrivateLateBoundObject As System.Management.ManagementObject

        'Member variable to store the 'automatic commit' behavior for the class.
        Private AutoCommitProp As Boolean

        'Private variable to hold the embedded property representing the instance.
        Private embeddedObj As System.Management.ManagementBaseObject

        'The current WMI object used
        Private curObj As System.Management.ManagementBaseObject

        'Flag to indicate if the instance is an embedded object.
        Private isEmbedded As Boolean

        'Below are different overloads of constructors to initialize an instance of the class with a WMI object.
        Public Sub New()
            MyBase.New()
            Me.InitializeObject(Nothing, Nothing, Nothing)
        End Sub

        Public Sub New(ByVal keyipAdEntAddr As String)
            MyBase.New()
            Me.InitializeObject(Nothing, New System.Management.ManagementPath(Rfc1213_mib_ipaddrtable.ConstructPath(keyipAdEntAddr)), Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal keyipAdEntAddr As String)
            MyBase.New()
            Me.InitializeObject(CType(mgmtScope, System.Management.ManagementScope), New System.Management.ManagementPath(Rfc1213_mib_ipaddrtable.ConstructPath(keyipAdEntAddr)), Nothing)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(Nothing, path, getOptions)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, Nothing)
        End Sub

        Public Sub New(ByVal path As System.Management.ManagementPath)
            MyBase.New()
            Me.InitializeObject(Nothing, path, Nothing)
        End Sub

        Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            MyBase.New()
            Me.InitializeObject(mgmtScope, path, getOptions)
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                PrivateLateBoundObject = theObject
                PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
                curObj = PrivateLateBoundObject
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        Public Sub New(ByVal theObject As System.Management.ManagementBaseObject)
            MyBase.New()
            Initialize()
            If (CheckIfProperClass(theObject) = True) Then
                embeddedObj = theObject
                PrivateSystemProperties = New ManagementSystemProperties(theObject)
                curObj = embeddedObj
                isEmbedded = True
            Else
                Throw New System.ArgumentException("Class name does not match.")
            End If
        End Sub

        'Property returns the namespace of the WMI class.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property OriginatingNamespace() As String
            Get
                Return "root\snmp\smir"
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property ManagementClassName() As String
            Get
                Dim strRet As String = CreatedClassName
                If (Not (curObj) Is Nothing) Then
                    If (Not (curObj.ClassPath) Is Nothing) Then
                        strRet = CType(curObj("__CLASS"), String)
                        If ((strRet Is Nothing) _
                                    OrElse (strRet Is String.Empty)) Then
                            strRet = CreatedClassName
                        End If
                    End If
                End If
                Return strRet
            End Get
        End Property

        'Property pointing to an embedded object to get System properties of the WMI object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property SystemProperties() As ManagementSystemProperties
            Get
                Return PrivateSystemProperties
            End Get
        End Property

        'Property returning the underlying lateBound object.
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property LateBoundObject() As System.Management.ManagementBaseObject
            Get
                Return curObj
            End Get
        End Property

        'ManagementScope of the object.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property Scope() As System.Management.ManagementScope
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Scope
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                If (isEmbedded = False) Then
                    PrivateLateBoundObject.Scope = value
                End If
            End Set
        End Property

        'Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property).
        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Property AutoCommit() As Boolean
            Get
                Return AutoCommitProp
            End Get
            Set(ByVal value As Boolean)
                AutoCommitProp = value
            End Set
        End Property

        'The ManagementPath of the underlying WMI object.
        <Browsable(True)> _
        Public Property Path() As System.Management.ManagementPath
            Get
                If (isEmbedded = False) Then
                    Return PrivateLateBoundObject.Path
                Else
                    Return Nothing
                End If
            End Get
            Set(ByVal value As System.Management.ManagementPath)
                If (isEmbedded = False) Then
                    If (CheckIfProperClass(Nothing, value, Nothing) <> True) Then
                        Throw New System.ArgumentException("Class name does not match.")
                    End If
                    PrivateLateBoundObject.Path = value
                End If
            End Set
        End Property

        'Public static scope property which is used by the various methods.
        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public Shared Property StaticScope() As System.Management.ManagementScope
            Get
                Return statMgmtScope
            End Get
            Set(ByVal value As System.Management.ManagementScope)
                statMgmtScope = value
            End Set
        End Property

#End Region

#Region "attributes"


        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property ipAdEntAddr() As String
            Get
                Return CType(curObj("ipAdEntAddr"), String)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipAdEntBcastAddrNull() As Boolean
            Get
                If (curObj("ipAdEntBcastAddr") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ipAdEntBcastAddr() As Integer
            Get
                If (curObj("ipAdEntBcastAddr") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipAdEntBcastAddr"), Integer)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipAdEntIfIndexNull() As Boolean
            Get
                If (curObj("ipAdEntIfIndex") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ipAdEntIfIndex() As Integer
            Get
                If (curObj("ipAdEntIfIndex") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipAdEntIfIndex"), Integer)
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property ipAdEntNetMask() As String
            Get
                Return CType(curObj("ipAdEntNetMask"), String)
            End Get
        End Property

        <Browsable(False), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
        Public ReadOnly Property IsipAdEntReasmMaxSizeNull() As Boolean
            Get
                If (curObj("ipAdEntReasmMaxSize") Is Nothing) Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        <Browsable(True), _
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
         TypeConverter(GetType(WMIValueTypeConverter))> _
        Public ReadOnly Property ipAdEntReasmMaxSize() As Integer
            Get
                If (curObj("ipAdEntReasmMaxSize") Is Nothing) Then
                    Return System.Convert.ToInt32(0)
                End If
                Return CType(curObj("ipAdEntReasmMaxSize"), Integer)
            End Get
        End Property

#End Region


#Region "the rest"



        Private Overloads Function CheckIfProperClass(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal OptionsParam As System.Management.ObjectGetOptions) As Boolean
            If ((Not (path) Is Nothing) _
                        AndAlso (String.Compare(path.ClassName, Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Return CheckIfProperClass(New System.Management.ManagementObject(mgmtScope, path, OptionsParam))
            End If
        End Function

        Private Overloads Function CheckIfProperClass(ByVal theObj As System.Management.ManagementBaseObject) As Boolean
            If ((Not (theObj) Is Nothing) _
                        AndAlso (String.Compare(CType(theObj("__CLASS"), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0)) Then
                Return True
            Else
                Dim parentClasses As System.Array = CType(theObj("__DERIVATION"), System.Array)
                If (Not (parentClasses) Is Nothing) Then
                    Dim count As Integer = 0
                    count = 0
                    Do While (count < parentClasses.Length)
                        If (String.Compare(CType(parentClasses.GetValue(count), String), Me.ManagementClassName, True, System.Globalization.CultureInfo.InvariantCulture) = 0) Then
                            Return True
                        End If
                        count = (count + 1)
                    Loop
                End If
            End If
            Return False
        End Function

        Private Function ShouldSerializeipAdEntBcastAddr() As Boolean
            If (Me.IsipAdEntBcastAddrNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeipAdEntIfIndex() As Boolean
            If (Me.IsipAdEntIfIndexNull = False) Then
                Return True
            End If
            Return False
        End Function

        Private Function ShouldSerializeipAdEntReasmMaxSize() As Boolean
            If (Me.IsipAdEntReasmMaxSizeNull = False) Then
                Return True
            End If
            Return False
        End Function

        <Browsable(True)> _
        Public Overloads Sub CommitObject()
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put()
            End If
        End Sub

        <Browsable(True)> _
        Public Overloads Sub CommitObject(ByVal putOptions As System.Management.PutOptions)
            If (isEmbedded = False) Then
                PrivateLateBoundObject.Put(putOptions)
            End If
        End Sub

        Private Sub Initialize()
            AutoCommitProp = True
            isEmbedded = False
        End Sub

        Private Shared Function ConstructPath(ByVal keyipAdEntAddr As String) As String
            Dim strPath As String = "root\snmp\smir:snmp_rfc1213_mib_ipaddrtable"
            strPath = String.Concat(strPath, String.Concat(".ipAdEntAddr=", String.Concat("""", String.Concat(keyipAdEntAddr, """"))))
            Return strPath
        End Function

        Private Sub InitializeObject(ByVal mgmtScope As System.Management.ManagementScope, ByVal path As System.Management.ManagementPath, ByVal getOptions As System.Management.ObjectGetOptions)
            Initialize()
            If (Not (path) Is Nothing) Then
                If (CheckIfProperClass(mgmtScope, path, getOptions) <> True) Then
                    Throw New System.ArgumentException("Class name does not match.")
                End If
            End If
            PrivateLateBoundObject = New System.Management.ManagementObject(mgmtScope, path, getOptions)
            PrivateSystemProperties = New ManagementSystemProperties(PrivateLateBoundObject)
            curObj = PrivateLateBoundObject
        End Sub

        'Different overloads of GetInstances() help in enumerating instances of the WMI class.
        Public Overloads Shared Function GetInstances() As Rfc1213_mib_ipaddrtableCollection
            Return GetInstances(Nothing, Nothing, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal condition As String) As Rfc1213_mib_ipaddrtableCollection
            Return GetInstances(Nothing, condition, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal selectedProperties() As System.String) As Rfc1213_mib_ipaddrtableCollection
            Return GetInstances(Nothing, Nothing, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal condition As String, ByVal selectedProperties() As System.String) As Rfc1213_mib_ipaddrtableCollection
            Return GetInstances(Nothing, condition, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal enumOptions As System.Management.EnumerationOptions) As Rfc1213_mib_ipaddrtableCollection
            If (mgmtScope Is Nothing) Then
                If (statMgmtScope Is Nothing) Then
                    mgmtScope = New System.Management.ManagementScope
                    mgmtScope.Path.NamespacePath = "root\snmp\smir"
                Else
                    mgmtScope = statMgmtScope
                End If
            End If
            Dim pathObj As System.Management.ManagementPath = New System.Management.ManagementPath
            pathObj.ClassName = "snmp_rfc1213_mib_ipaddrtable"
            pathObj.NamespacePath = "root\snmp\smir"
            Dim clsObject As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, pathObj, Nothing)
            If (enumOptions Is Nothing) Then
                enumOptions = New System.Management.EnumerationOptions
                enumOptions.EnsureLocatable = True
            End If
            Return New Rfc1213_mib_ipaddrtableCollection(clsObject.GetInstances(enumOptions))
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal condition As String) As Rfc1213_mib_ipaddrtableCollection
            Return GetInstances(mgmtScope, condition, Nothing)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal selectedProperties() As System.String) As Rfc1213_mib_ipaddrtableCollection
            Return GetInstances(mgmtScope, Nothing, selectedProperties)
        End Function

        Public Overloads Shared Function GetInstances(ByVal mgmtScope As System.Management.ManagementScope, ByVal condition As String, ByVal selectedProperties() As System.String) As Rfc1213_mib_ipaddrtableCollection
            If (mgmtScope Is Nothing) Then
                If (statMgmtScope Is Nothing) Then
                    mgmtScope = New System.Management.ManagementScope
                    mgmtScope.Path.NamespacePath = "root\snmp\smir"
                Else
                    mgmtScope = statMgmtScope
                End If
            End If
            Dim ObjectSearcher As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher(mgmtScope, New SelectQuery("snmp_rfc1213_mib_ipaddrtable", condition, selectedProperties))
            Dim enumOptions As System.Management.EnumerationOptions = New System.Management.EnumerationOptions
            enumOptions.EnsureLocatable = True
            ObjectSearcher.Options = enumOptions
            Return New Rfc1213_mib_ipaddrtableCollection(ObjectSearcher.Get)
        End Function

        <Browsable(True)> _
        Public Shared Function CreateInstance() As Rfc1213_mib_ipaddrtable
            Dim mgmtScope As System.Management.ManagementScope = Nothing
            If (statMgmtScope Is Nothing) Then
                mgmtScope = New System.Management.ManagementScope
                mgmtScope.Path.NamespacePath = CreatedWmiNamespace
            Else
                mgmtScope = statMgmtScope
            End If
            Dim mgmtPath As System.Management.ManagementPath = New System.Management.ManagementPath(CreatedClassName)
            Dim tmpMgmtClass As System.Management.ManagementClass = New System.Management.ManagementClass(mgmtScope, mgmtPath, Nothing)
            Return New Rfc1213_mib_ipaddrtable(tmpMgmtClass.CreateInstance)
        End Function

        <Browsable(True)> _
        Public Sub Delete()
            PrivateLateBoundObject.Delete()
        End Sub

        'Enumerator implementation for enumerating instances of the class.
        Public Class Rfc1213_mib_ipaddrtableCollection
            Inherits Object
            Implements ICollection

            Private privColObj As ManagementObjectCollection

            Public Sub New(ByVal objCollection As ManagementObjectCollection)
                MyBase.New()
                privColObj = objCollection
            End Sub

            Public Overridable ReadOnly Property Count() As Integer Implements System.Collections.ICollection.Count
                Get
                    Return privColObj.Count
                End Get
            End Property

            Public Overridable ReadOnly Property IsSynchronized() As Boolean Implements System.Collections.ICollection.IsSynchronized
                Get
                    Return privColObj.IsSynchronized
                End Get
            End Property

            Public Overridable ReadOnly Property SyncRoot() As Object Implements System.Collections.ICollection.SyncRoot
                Get
                    Return Me
                End Get
            End Property

            Public Overridable Sub CopyTo(ByVal array As System.Array, ByVal index As Integer) Implements System.Collections.ICollection.CopyTo
                privColObj.CopyTo(array, index)
                Dim nCtr As Integer
                nCtr = 0
                Do While (nCtr < array.Length)
                    array.SetValue(New Rfc1213_mib_ipaddrtable(CType(array.GetValue(nCtr), System.Management.ManagementObject)), nCtr)
                    nCtr = (nCtr + 1)
                Loop
            End Sub

            Public Overridable Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
                Return New Rfc1213_mib_ipaddrtableEnumerator(privColObj.GetEnumerator)
            End Function

            Public Class Rfc1213_mib_ipaddrtableEnumerator
                Inherits Object
                Implements System.Collections.IEnumerator

                Private privObjEnum As ManagementObjectCollection.ManagementObjectEnumerator

                Public Sub New(ByVal objEnum As ManagementObjectCollection.ManagementObjectEnumerator)
                    MyBase.New()
                    privObjEnum = objEnum
                End Sub

                Public Overridable ReadOnly Property Current() As Object Implements System.Collections.IEnumerator.Current
                    Get
                        Return New Rfc1213_mib_ipaddrtable(CType(privObjEnum.Current, System.Management.ManagementObject))
                    End Get
                End Property

                Public Overridable Function MoveNext() As Boolean Implements System.Collections.IEnumerator.MoveNext
                    Return privObjEnum.MoveNext
                End Function

                Public Overridable Sub Reset() Implements System.Collections.IEnumerator.Reset
                    privObjEnum.Reset()
                End Sub
            End Class
        End Class

        'TypeConverter to handle null values for ValueType properties
        Public Class WMIValueTypeConverter
            Inherits TypeConverter

            Private baseConverter As TypeConverter

            Private baseType As System.Type

            Public Sub New(ByVal inBaseType As System.Type)
                MyBase.New()
                baseConverter = TypeDescriptor.GetConverter(inBaseType)
                baseType = inBaseType
            End Sub

            Public Overloads Overrides Function CanConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal srcType As System.Type) As Boolean
                Return baseConverter.CanConvertFrom(context, srcType)
            End Function

            Public Overloads Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As System.Type) As Boolean
                Return baseConverter.CanConvertTo(context, destinationType)
            End Function

            Public Overloads Overrides Function ConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
                Return baseConverter.ConvertFrom(context, culture, value)
            End Function

            Public Overloads Overrides Function CreateInstance(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal dictionary As System.Collections.IDictionary) As Object
                Return baseConverter.CreateInstance(context, dictionary)
            End Function

            Public Overloads Overrides Function GetCreateInstanceSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetCreateInstanceSupported(context)
            End Function

            Public Overloads Overrides Function GetProperties(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal value As Object, ByVal attributeVar() As System.Attribute) As PropertyDescriptorCollection
                Return baseConverter.GetProperties(context, value, attributeVar)
            End Function

            Public Overloads Overrides Function GetPropertiesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetPropertiesSupported(context)
            End Function

            Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
                Return baseConverter.GetStandardValues(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesExclusive(context)
            End Function

            Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
                Return baseConverter.GetStandardValuesSupported(context)
            End Function

            Public Overloads Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
                If (baseType.BaseType Is GetType(System.[Enum])) Then
                    If (value.GetType Is destinationType) Then
                        Return value
                    End If
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return "NULL_ENUM_VALUE"
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((baseType Is GetType(Boolean)) _
                            AndAlso (baseType.BaseType Is GetType(System.ValueType))) Then
                    If (((value = Nothing) _
                                AndAlso (Not (context) Is Nothing)) _
                                AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                        Return ""
                    End If
                    Return baseConverter.ConvertTo(context, culture, value, destinationType)
                End If
                If ((Not (context) Is Nothing) _
                            AndAlso (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) = False)) Then
                    Return ""
                End If
                Return baseConverter.ConvertTo(context, culture, value, destinationType)
            End Function
        End Class

        'Embedded class to represent WMI system Properties.
        <TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _
        Public Class ManagementSystemProperties

            Private PrivateLateBoundObject As System.Management.ManagementBaseObject

            Public Sub New(ByVal ManagedObject As System.Management.ManagementBaseObject)
                MyBase.New()
                PrivateLateBoundObject = ManagedObject
            End Sub

            <Browsable(True)> _
            Public ReadOnly Property GENUS() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__GENUS"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [CLASS]() As String
                Get
                    Return CType(PrivateLateBoundObject("__CLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SUPERCLASS() As String
                Get
                    Return CType(PrivateLateBoundObject("__SUPERCLASS"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DYNASTY() As String
                Get
                    Return CType(PrivateLateBoundObject("__DYNASTY"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property RELPATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__RELPATH"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PROPERTY_COUNT() As Integer
                Get
                    Return CType(PrivateLateBoundObject("__PROPERTY_COUNT"), Integer)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property DERIVATION() As String()
                Get
                    Return CType(PrivateLateBoundObject("__DERIVATION"), String())
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property SERVER() As String
                Get
                    Return CType(PrivateLateBoundObject("__SERVER"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property [NAMESPACE]() As String
                Get
                    Return CType(PrivateLateBoundObject("__NAMESPACE"), String)
                End Get
            End Property

            <Browsable(True)> _
            Public ReadOnly Property PATH() As String
                Get
                    Return CType(PrivateLateBoundObject("__PATH"), String)
                End Get
            End Property
        End Class

#End Region


    End Class ' Rfc1213_mib_ipaddrtable






#End Region

End Class
